Hi Gang!
Here's the skinny:
I am working on a simple db app that reads and updates a db on SQL Server 7. When I ONLY have the connection string in the code, I can connect just fine. When I add code to manipulate data, I lose the connection to the db.
How can this be
The code that causes the problem is below.
Thanks for you help.
Dim conn As New SqlClient.SqlConnection
' TODO: Modify the connection string and include any
' additional required properties for your database.
conn.ConnectionString = "integrated security=SSPI;data source=PROGRAMMING;" & _
"persist security info=False;initial catalog=SShopDB"
Dim sql As String = "SELECT * FROM SShopDB"
Dim cmd As New SqlClient.SqlCommand(sql, conn)
Try
conn.Open()
Dim reader As System.Xml.XmlReader = cmd.ExecuteXmlReader()
Do While reader.Read()
txtOut.AppendText(reader.Value & ControlChars.CrLf)
Loop
Catch ex As Exception
MessageBox.Show("Failed to connect to data source")
Finally
conn.Close()
End Try
End Sub

SQL Server Bugaboo
Ben Docume
I am using vb.net, and am just really lost. If there was a simple list of instructions somewhere that listed what I needed to do, life would be easier. LOL
Anyway, thanks for your help. I am new to database apps in vb.net. I have done it with MySQL and PHP. This is new to me, but I need to know it.
Thanks again!
Gary
TJHinUSA
cmd.Connection.Open();
//Update data here
cmd.Connection.Close();
jrbeachy
kiln