I have a SQL server table where I want to query for items on rows which have a value equal to an item in Array. Here’s my example: And my array: So, I want to return from SQL rows matching items in the array. my SQL query should return items where column1 matches an item in the array: This all
Tag: c#
SqlBulkCopy ColumnMapping Error
My goal is to copy generic tables from one database to another. I would like to have it copy the data as is and it would be fine to either delete whatever is in the table or to add to it with new …
ConfigurationManager in WPF
I have a config file in a wpf project to store the connectionstring. But when I try to get AppSettings and ConnectionStrings, I get null. the WEB.config file is like this: I tried in several ways: None of them worked. But this one worked: (That means I cannot use a config file, which is against my will) I need help.
Stuck on SqlDataReader.GetValues Method
I am making a call to a SQL stored procedure which is returning a small table of users and their bosses. What I would like to do is compare this information against a variable in a different part of …
Stored Procedure Return Type Can Not Be Detected
I am trying to drag this procedure over to the dbml in VS 2012 and I am getting the return type cannot be detected message. I have tried these: LINQ to SQL – Stored Procedure Return Type Error The …
Call the maximum from SQL table to textbox
I am working on a Windows Forms C# application and I need to auto generate my invoice number from my database. For that I need to get the maximum value from the database and want to add one with the max value in db, any idea Answer You could design your database table using an IDENTITY column. The database will
SQL Insert Query Using C#
I’m having an issue at the moment which I am trying to fix. I just tried to access a database and insert some values with the help of C# The things I tried (worked) A new line was inserted and everything worked fine, now I tried to insert a row using variables: Didn’t work, no values were inserted. I tried
DropDownList has a SelectedValue which is invalid because it does not exist in the list of items. Parameter name: value
I keep getting the above error in the title line and it makes no sense, because I am using a sample table with only 5 records and each record has a value as per the drop down menu. This is my code used to declare the drop down list. I have joined two tables in my SQL data source to
Performance for using 2 where clauses in LINQ
In LINQ-to-Entities you can query entities by doing: I know that behind the scenes it will be translated to SQL to something similar to: However is there a difference (with respect to performance) if I write: Will it be translated to the same SQL query? From my understanding .Where() will return IEnumerable<T> so the second .Where() will filter the entities
The provider did not return a ProviderManifestToken string Entity Framework
An error occurred while getting provider information from the database. This can be caused by Entity Framework using an incorrect connection string. Check the inner exceptions for details and ensure …