Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
anishkumar
New Member

[Expression.Error] The parameter "database" doesn’t exist in the current context

Hi 

I am using the following project template to provide native query support to my Power Bi custom connector.

https://github.com/microsoft/DataConnectors/blob/master/samples/NativeQuery/ODBC/SQL%20ODBC/Finish/S...

 

In the source code SqlODBC.Contents  contains three parameters for server, database and options(For native query).

 

[DataSource.Kind="SqlODBC", Publish="SqlODBC.Publish"]

shared SqlODBC.Contents = ( server as text, optional database as text, optional options as record ) =>

 

When I select my connector using "Get Data" and click the connector, a screen appears with there text boxes.

Text box 1 - Server address

Text box 2 - Database name

Text Area - For entering native query like select * from some table.

 

But in my case I would like to get database information from an authenticated API. So I don’t need the Server Address and Database name text boxes any more.  I removed the parameters "server as text" and "optional database as text" from SqlODBC.Contents parameters

Now it looks like below and new screen does not have text boxes for server and database (Only Native query text area is present)

 

[DataSource.Kind="SqlODBC", Publish="SqlODBC.Publish"]

shared SqlODBC.Contents = (  options as record ) =>

 

And for the testing purpose I hardcoded the servername and database name in my code as given below. (Instead of getting it from text boxes)

 

[DataSource.Kind="SqlODBC", Publish="SqlODBC.Publish"]

shared SqlODBC.Contents = ( options as record ) =>

    let

        server = "my azure sql server address",

        database = "my database name",

 

and the Screen looks like 

 
and the Screen looks like 
anishkumar_1-1689873547410.png

 

BUT NOW I AM GETTING THE FOLLOWING ERROR MESSAGE FROM SOME WHERE IN THE LIBRARY 

----------------------------------------------------------------------------------------------------------------------------------------

[Expression.Error] The parameter "database" doesn’t exist in the current context. Please check the connector native query implementation.

----------------------------------------------------------------------------------------------------------------------------------------

If I add the Database parameter back into the parameter list and get the database name from text box, then native query is working fine

 

Please provide me a feasible solution as my customer doesn't want to enter server address and database name.

 

Thanks and regards

Anishkumar.M

0 REPLIES 0

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors