Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27184

VS 2010 Select From SQL Then Value To Text Box

$
0
0
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:

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)


Viewing all articles
Browse latest Browse all 27184

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>