Datagridview problem
-
Hi I am developing windows based application ... write this code to fill the datagridview..... i am getting error at fill that
If con.State = ConnectionState.Open Then con.Close() con.Open() Dim sqlcommand1 As New SqlClient.SqlCommand("usp_FillVS", con) sqlcommand1.CommandType = CommandType.StoredProcedure sqlcommand1.Parameters.Add("@ApplicationNumber", SqlDbType.BigInt).Value = ApplicationNumber sqlcommand1.ExecuteNonQuery() Dim GDataAdapter As New SqlClient.SqlDataAdapter GDataAdapter.Fill(GDataSet, "Outbound_Data") DataGridView1.DataSource = GDataSet
-
Hi I am developing windows based application ... write this code to fill the datagridview..... i am getting error at fill that
If con.State = ConnectionState.Open Then con.Close() con.Open() Dim sqlcommand1 As New SqlClient.SqlCommand("usp_FillVS", con) sqlcommand1.CommandType = CommandType.StoredProcedure sqlcommand1.Parameters.Add("@ApplicationNumber", SqlDbType.BigInt).Value = ApplicationNumber sqlcommand1.ExecuteNonQuery() Dim GDataAdapter As New SqlClient.SqlDataAdapter GDataAdapter.Fill(GDataSet, "Outbound_Data") DataGridView1.DataSource = GDataSet
Hi, As u have not set any sql command for GDataAdapter u r getting that error.....
Regards, Sandeep Kumar.V
-
Hi, As u have not set any sql command for GDataAdapter u r getting that error.....
Regards, Sandeep Kumar.V
Hi, Thanks for your kind reply. code is executed without any error but data is not displayed... i am working on window based application previously i work on web application so on simple thing i find difficult.
If con.State = ConnectionState.Open Then con.Close() con.Open() Dim sqlcommand1 As New SqlClient.SqlCommand("usp_FillVS", con) sqlcommand1.CommandType = CommandType.StoredProcedure sqlcommand1.Parameters.Add("@ApplicationNumber", SqlDbType.BigInt).Value = ApplicationNumber sqlcommand1.ExecuteNonQuery() 'dataReader = sqlcommand1.ExecuteReader Dim GDataAdapter As New SqlClient.SqlDataAdapter ' OleDbDataAdapter myAdapter = new OleDbDataAdapter(myCommand); GDataAdapter = New SqlDataAdapter(sqlcommand1) GDataAdapter.Fill(GDataSet, "Outbound_Data") DataGridView1.DataSource = GDataSet
-
Hi, Thanks for your kind reply. code is executed without any error but data is not displayed... i am working on window based application previously i work on web application so on simple thing i find difficult.
If con.State = ConnectionState.Open Then con.Close() con.Open() Dim sqlcommand1 As New SqlClient.SqlCommand("usp_FillVS", con) sqlcommand1.CommandType = CommandType.StoredProcedure sqlcommand1.Parameters.Add("@ApplicationNumber", SqlDbType.BigInt).Value = ApplicationNumber sqlcommand1.ExecuteNonQuery() 'dataReader = sqlcommand1.ExecuteReader Dim GDataAdapter As New SqlClient.SqlDataAdapter ' OleDbDataAdapter myAdapter = new OleDbDataAdapter(myCommand); GDataAdapter = New SqlDataAdapter(sqlcommand1) GDataAdapter.Fill(GDataSet, "Outbound_Data") DataGridView1.DataSource = GDataSet
Hi,
soniasan wrote:
sqlcommand1.ExecuteNonQuery()
comment the above line and try to execute the code...
Regards, Sandeep Kumar.V