Home > Software engineering >  Something is wrong with VB links database queries
Something is wrong with VB links database queries

Time:10-02

I made a simple login form, determine the key to jump to the second window, link the database query information, I have looked in DataGridView links database, need to do in tetxbox input is the function of disk serial number, I can find the number of movie name and price and release date, but frame2 code is always wrong, I'm not going to VB, this is to be used for homework
If you have will write VB please help me


 
Private Sub ToolStripButton1_Click (ByVal sender As System. Object, ByVal e the As System. EventArgs) Handles ToolStripButton1. Click
SqlConnection1 (conn=New)
SqlConnection1 (ConfigurationManagar ConmnectionString [" ZLConnectionString] "). The Tostring ());
SqlDataAdapter1 da=New SqlDataAdaper1 ();
conn.Open();
Da. SelectCommand1=New SqlCommand ();
Da.SelectCommand1.Com mandText="get_dpxx"
Data. SelectCommand1. The parameters. The Add (" @ dpxx_bh ", SqlDbType. Int). The Value=https://bbs.csdn.net/topics/(TextBox1. Text). The ToString ();
Da.SelectCommand1.Com mandType=CommandType. StoredProcedure;
DataGridView1=da. SelectCommand. ExecuteReader ();
DataGridView1. DataBind ();
conn.Close();


SQLD ()
End Sub

CodePudding user response:

conn.Close();
First take a look at it is written in the second window closing event,

CodePudding user response:

Removed, still won't do
 Private Sub ToolStripButton1_Click (ByVal sender As System. Object, ByVal e the As System. EventArgs) Handles ToolStripButton1. Click 

Try
Me. SqlDataAdapter1. The Fill (Me) ZLDataSet, CType (TextBox1. Text, Integer))
Catch the ex As Exception
System. Windows. Forms. MessageBox. Show (ex. Message)

End the Try
  • Related