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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.