Hi,
I am writing this question because I cannot find the answer (thus far) to it in the other threads.
I am a asp.net developer trying to develop a client/sever application in
vb.net. Here is my problem, I have a
form (frmMain) and a Module (sqlConn).
frmMain contains a textbox (txtDescription) as well as a button (btnConnect) that when selected, calls ConnectToSql() - in Module (sqlConn).
The Module connects to the DB as follows:
Code:
PublicSub ConnectToSql()
Conn.ConnectionString = "Server=theServer;Database=theDB;" & _
"User ID=user;Password=pwd;Trusted_Connection=True;"
Try
Conn.Open()
' Insert code to process data.
Dim sqlCmd AsNew SqlCommand("SELECT mydesc from tb_desc", Conn)
Dim sqlDa AsNew SqlDataAdapter(sqlCmd)
sqlDa.Fill(dt)
If dt.Rows.Count > 0 Then
txtDescription.Text = dt.Rows(0)("my_desc").ToString
EndIf
Catch ex As Exception
MessageBox.Show("Failed to connect to data source")
Finally
Conn.Close()
EndTry
EndSub
FYI - By the way,
this has to be coded (I cannot use databinds) and for those that do not like inline Sql, I will create a Sproc once this is up and running.
I am able to see all of the records from the selected table.
My question is, how do I get the results from the Module to the txtDescription textbox in the Windows form? Your help is greatly appreciated as I am behind the

with this time sensitive issue.
Regards!