Closed Jass7 closed 6 years ago
Hi Jasmina,
At the first look it seems to me that you haven't provided connection string to RestApi or you are somehow providing SqlConnection without set connection string. The exception is thrown here:
https://github.com/JocaPC/Belgrade-SqlClient/blob/master/Code/Common/GenericCommand.cs#L30
Could you run your code that initializes RestApi it in debugger and check is there are connection string value in the code that you are calling. My first guess is that some code didn't read the value from some config file.
Hi Jovan, Thanks a lot for a prompt response, now it seems I can establish a connection to the server but I am getting the following message : {"code":208,"message":{"lang":"en","value":"Invalid object name 'Application.People'.","innererror":null}} In my database, I made the schema named Application and also I do have all tables with exact names and names of columns. All of them are granted to public (please take a look at 2 print-screens in attachment). Sorry that I came up with a new question. Best regards, Jasmina
You need to put tables in Application schema and not in dbo schema, or put "dbo.Invoices" instead of "Application.Invoices". Maybe you can use other constructor new TableSpec(schema:"dbo", table:"Invoices"). See examples here: https://github.com/Microsoft/sql-server-samples/tree/master/samples/databases/wide-world-importers/wwi-app/Controllers
Note that I just published the latest code in different nuget package MsSql.RestApi instead of old SQL-Server-Rest-Api.
Thanks a lot Jovan, now it works fine. :)
Hello Jovan, First thanks for this great work. I am trying to implement this project but getting some notnullexception... I don't have null values in my columns, and connection string is set properly per your instructions. Here is the exception:
" An unhandled exception occurred while processing the request. ArgumentNullException: Value cannot be null. Parameter name: Connection string is not set. Belgrade.SqlClient.Common.GenericCommand..ctor(DbConnection connection)
Stack Query Cookies Headers ArgumentNullException: Value cannot be null. Parameter name: Connection string is not set. Belgrade.SqlClient.Common.GenericCommand..ctor(DbConnection connection) MsSql.RestApi.StartUp.CreateCommand(Option options, IServiceProvider sp) in StartUp.cs
MsSql.RestApi.StartUp+<>c__DisplayClass1_0.b__2(IServiceProvider sp) in StartUp.cs
" Can you please advise what I should do to solve this problem. Just to mention, I did basic settings without experimenting and creating a simple database with fields defined in your project, all tables are filled with values. Only I am not sure does Sales should also be a created table in dB with columns CustomerId, OrderID, InvoiceID? Thanks in advance Best regards Jasmina