jmcilhinney,
Hi! I'm trying to databind a pair of textboxes to a dataset based on a stored procedure and for some reason it's failing. Where am I going wrong?
Edit: Form1.adid is a variable passed from another form and captured from the system environment of the user that correllates with the parameter of the stored procedure. Just FYI so you know why it's there.
Many thanks in advance!Code:connection.Open() 'populate text boxes Dim cmSQL As SqlCommand = New SqlCommand("getAgent", connection) cmSQL.CommandType = CommandType.StoredProcedure cmSQL.Parameters.AddWithValue("@IID", Form1.adid) Dim daAgent As New SqlDataAdapter(cmSQL) daAgent.SelectCommand = cmSQL Dim dsAgent As New DataSet daAgent.Fill(dsAgent) Try Me.TextBox1.DataBindings.Add("Text", dsAgent.Tables(0).Columns(0), "Name") Me.TextBox2.DataBindings.Add("Text", dsAgent.Tables(0).Columns(1), "[Sprint Email]") Catch ex As System.Exception 'System.Windows.Forms.MessageBox.Show(ex.Message) MsgBox("Unable to retrieve your Name and Email address.", MsgBoxStyle.Exclamation, "Database Error") End Try




Reply With Quote