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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

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
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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