B
backwards15
Hi all,
Just having a bit of trouble in returning the results of the SQL
SELECT statement to a textbox
This is only to return one row and i'm not sure how to get it to
display in the text box.
here is my code so far
Private Sub Btn_find_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Btn_find.Click
sql.ConnectionString = ("Data Source=" +
Me.Combo_kiosk.Text.ToString() + ";Application Name = " +
Application.ProductName + ";Initial Catalog=test;Integrated
Security=SSPI")
sql.Open()
cmd.Connection = sql
cmd.CommandType = CommandType.Text
cmd.CommandText = "SELECT OfferID FROM smspromotionaloffer
WHERE OfferKioskText LIKE '%" + Me.txt_input.Text + "%'"
'cmd.ExecuteReader()
Dim ds As New DataSet()
Dim da As New SqlClient.SqlDataAdapter(cmd)
da.Fill(ds, "Output")
txt_offer.Text = ds.Tables(0).Columns(0).ToString
sql.Close()
End Sub
Atm i get the coloum name show in the textbox. i'm rather new to
programing and i know thats not the right way of doing this.
thanks in adavance
Andy
Just having a bit of trouble in returning the results of the SQL
SELECT statement to a textbox
This is only to return one row and i'm not sure how to get it to
display in the text box.
here is my code so far
Private Sub Btn_find_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Btn_find.Click
sql.ConnectionString = ("Data Source=" +
Me.Combo_kiosk.Text.ToString() + ";Application Name = " +
Application.ProductName + ";Initial Catalog=test;Integrated
Security=SSPI")
sql.Open()
cmd.Connection = sql
cmd.CommandType = CommandType.Text
cmd.CommandText = "SELECT OfferID FROM smspromotionaloffer
WHERE OfferKioskText LIKE '%" + Me.txt_input.Text + "%'"
'cmd.ExecuteReader()
Dim ds As New DataSet()
Dim da As New SqlClient.SqlDataAdapter(cmd)
da.Fill(ds, "Output")
txt_offer.Text = ds.Tables(0).Columns(0).ToString
sql.Close()
End Sub
Atm i get the coloum name show in the textbox. i'm rather new to
programing and i know thats not the right way of doing this.
thanks in adavance
Andy