Hi all,
as a beginner i am struggling slightly with a bit of code. Basically I want to connect to a sql database, grab a value from a table and put the result into a text box. I would greatly appriciate a pointer please.
Here is the code I am bungling:
as a beginner i am struggling slightly with a bit of code. Basically I want to connect to a sql database, grab a value from a table and put the result into a text box. I would greatly appriciate a pointer please.
Here is the code I am bungling:
Code:
Dim myConnection As New SqlConnection()
myConnection.ConnectionString = "Server=SERVERNAMEREPLAVED;Database=DBNAMEHERE;Trusted_Connection=True;"
myConnection.Open()
Dim selectSQL As String = "select VALUESTRING from dbo.SYSTEMPROPERTY where KEYSTRING ='OUTLOOKINSTALLERPATH'"
Dim cmd As New SqlCommand(selectSQL, myConnection)
Dim ds As New DataSet
Dim da As SqlDataAdapter
da.Fill(ds, "ValueReturned")
txtEAInstallerPath.Text = ds.Tables(0).Rows(0).Item(1)