Help Please!!
Im getting this error:
Format of the initialization string does not conform to specification starting at index 0.I have read some documentation on this error and it says something about my connection string. I look at my connectionstring and dont see anything wrong with it. Here how it looks:<
appSettings>
<addkey="TheKey"value="Data Source=000.000.0.00;Initial Catalog=DBNAME;User ID=USERID;Password=PWORD;" />
</appSettings>
My code:
PublicSubNew(ByVal BrokerIDAsInteger)
Dim connectionAsNew SqlConnection("sqlConn")
Dim commandAsNew SqlCommand("tp_GetBroker", connection)command.CommandType = CommandType.StoredProcedure
command.Parameters.Add("@param_BrokerID", SqlDbType.Int).Value = BrokerID
connection.Open()
Dim readerAs SqlDataReader = Command.ExecuteReader()
If reader.ReadThen
_brokerID =CInt(reader("brokerID"))
_brokerRole =CInt(reader("brokerRole"))
_brokerType =CInt(reader("brokerType"))
_firstname = reader("fname")
_lastname = reader("lname")
_phone = reader("phone")
_email = reader("email")
_password = reader("b_password")
_regDate = reader("reg_date")
Else
PopulateDefault()
EndIf
reader.Close()
connection.Close()
EndSubPlease tell me what im doing wrong
Try these connection Strings, you will have to change the data to reflect your network.
Connecting via IP.
"Data Source=190.190.200.100,1433;Network Library=DBMSSOCN;Initial Catalog=pubs;User ID=sa;Password=asdasd;"
Standard SQl Logon Details,
"Server=Aron1;Database=pubs;User ID=sa;Password=asdasd;Trusted_Connection=False"
Trusted Connection, using windows login.
"Data Source=Aron1;Initial Catalog=pubs;Integrated Security=SSPI;"
or,
"Server=Aron1;Database=pubs;Trusted_Connection=True;"
Hope this helps..
The solution
I just change the way I was using my connection string and then IT WOKED!
If you look at my first post you will see the difference.

ASP.NET < WACKY
Revised Code
Public Sub New(ByVal BrokerID As Integer)
Dim connection As SqlConnection = New SqlConnection
connection.ConnectionString = sqlconn
connection.Open()
Dim command As New SqlCommand("tp_GetBroker", connection)
Command.CommandType = CommandType.StoredProcedure
command.Parameters.Add("@param_BrokerID", SqlDbType.Int).Value = BrokerID
Dim reader As SqlDataReader = Command.ExecuteReader()
If reader.Read Then
_brokerID = reader("brokerID")
_brokerRole = reader("brokerRole")
_brokerType = reader("brokerType")
_firstname = reader("fname")
_lastname = reader("lname")
_phone = reader("phone")
_email = reader("email")
_password = reader("b_password")
_regDate = reader("reg_date")
Else
PopulateDefault()
End If
reader.Close()
connection.Close()
End Sub