I have a winform (vs2010) and I am running the following code...
I am wondering how to reference my connection string that I have setup in the My Project - settings area. I already have that string in there with a name of MTConnectionString. Is there a way to use that instead of having to put this whole string in for every command query I run?
I tried
Using connection As New SqlConnection("MTConnectionString")
and I get an error ArgumentException was unhandled by user code. Format of the initialization string does not conform to specification starting at index 0. But it is exactly as the string is above. They are both the same!!
Thanks,
Stac
Code:
Using connection As New SqlConnection("Data Source=MNT-MGR-2\SQLEX;Initial Catalog=MT;Integrated Security=True")
' Create the command and set its properties.
Dim command As SqlCommand = New SqlCommand()
command.Connection = connection
command.CommandText = "POPartsPCSUpdate"
command.CommandType = CommandType.StoredProcedureI tried
Quote:
Using connection As New SqlConnection("MTConnectionString")
Thanks,
Stac