我做了一个简单的登陆窗体,按确定键跳转到第二窗口,链接数据库查询信息,我已经用看了DataGridView链接数据库,需要做到的功能是在tetxbox输入碟片编号,我就可以查到这个编号的电影名称和价格还有上映日期,可是frame2的代码总是错误的,我不会VB,要用这个来交作业
如果有会写VB的请帮帮我 Private Sub ToolStripButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton1.Click
        SqlConnection1(conn = New)
        SqlConnection1(ConfigurationManagar.ConmnectionString["ZLConnectionString"]).Tostring());
        SqlDataAdapter1 da = New SqlDataAdaper1();
        conn.Open();
        da.SelectCommand1 = New SqlCommand();
        da.SelectCommand1.CommandText = "get_dpxx"
        data.SelectCommand1.parameters.Add("@dpxx_bh", SqlDbType.Int).Value = (TextBox1.Text).ToString();
        da.SelectCommand1.CommandType= CommandType.StoredProcedure;
        DataGridView1 = da.SelectCommand.ExecuteReader();
        DataGridView1.DataBind();
        conn.Close();
        sqld()
    End Sub

解决方案 »

  1.   

    conn.Close();
    先去掉看看,写在第二窗口关闭事件里去。
      

  2.   

    去掉了,还是不行 Private Sub ToolStripButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton1.Click        Try
                Me.SqlDataAdapter1.Fill(Me.ZLDataSet, CType(TextBox1.Text, Integer))
            Catch ex As Exception
                System.Windows.Forms.MessageBox.Show(ex.Message)        End Try