[Solved] SQL Server with C#

Try This SqlConnection myConnection = new SqlConnection(“Data Source=Igor;Initial Catalog=Prueba;Integrated Security=True”); Edit2: For the Above Picture and for TEST_DB database the Connection String should be written as SqlConnection myConnection = new SqlConnection(“Data Source=AJMOT-PC;User ID=sa;Password=thisismypassword;Initial Catalog=TEST_DB;Integrated Security=True”); If you are using the Window authentication for sql server then you don’t need to declare the User ID=sa;Password=thisismypassword section. … Read more

[Solved] An unhandled exception of type ‘System.InvalidOperationException’ occurred in System.Data.dll?

You should either use this method: SqlCommand cmd = new SqlCommand(“dbo.workScheduleDataGrid”, sqlcon); or this method SqlCommand cmd = sqlcon.CreateCommand(); to create the command, but not both (the second assignment in your code overwrites the first one). With the second options, you need to specify the command to execute separarely: cmd.CommandText = “dbo.workScheduleDataGrid”; Also, do not … Read more

[Solved] How to pass parameters to SqlDataAdapter

here is an example of what you can use and how to pass Parameters you have to make the changes where necessary Public Shared Function GetCustomerInfo(stardate As DateTime, enddate As DateTime, Department As String, Active as String, Visits as Int33) As List(Of String) Dim cszList = New List(Of String)() Dim DSCityStateZipLookup As New DataSet() ‘load … Read more