Hello Everyone:

I want to grab information from my SQL Database and put that selected item into a textbox so that it can be manipulated later. The problem i seem to have is that I can't select text information. it seems to only work when i try and pull an integer out of the database. Is there a tutorial or any information on this matter.

On the same note, I also was wondering if ExecuteReader() returns values? if so then can I use ExecuteREader() to grab the information and then put it into the textbox?

So basically I Generate the SQL Statement and Connection

Private Sub ActivityChangeDataRetreive(ByVal ActivityName As String)
Dim ActivityConnection As New SqlClient.SqlConnection(connstring)
Dim ActivityCommand As New SqlClient.SqlCommand("Select chrAtvName From wrkActivity Where intActivityID = @ID")


I Assign the Connection to the SQL Command:

ActivityCommand.Connection = ActivityConnection

I then Assign the Parameter a Value (This was after I had it grab the ID that is returned when the user selects a certain activity ...("@ID", g_intActivityID)

ActivityCommand.Parameters.AddWithValue("@ID", 44)


I open, Execute, and close the connection assigning the returned value to a global string variable:
ActivityConnection.Open()
G_ActivityChangeID1 = ActivityCommand.ExecuteNonQuery()
ActivityConnection.Close()

textbox1.Text = G_ActivityChangeID1


End Sub

Should I have executeNonQuery() here or would it be better to have ExecuteReader() here instead, that way I can grab multiple values?


Thanks for viewing guys:

-NUStudent-