Click here to Skip to main content
15,886,199 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more: , +
Please help urgently. This is code to display data in a datagrid:
VB
Sub fill_grid()
  con.Open()
  com = New SqlCommand("proc_search", con)
  com.CommandType = Data.CommandType.StoredProcedure
  com.Parameters.Add(New SqlParameter("@Mode", Data.SqlDbType.VarChar, 20))
  com.Parameters.AddWithValue("@strFeedTitle", cmbtitle.Text)
  com.Parameters.AddWithValue("@strFeedNm", txtname.Text)
  com.Parameters.AddWithValue("@strFeedEmail", txtemail.Text)
  com.Parameters("@Mode").Value = "select1"
  da = New SqlDataAdapter
  da.SelectCommand = com
  da.SelectCommand.Connection = con
  ds = New DataSet
  'ds.Tables.Add("tbl1")
  da.Fill(ds, "tbl1")
  con.Close()
  Try
    If ds.Tables("tbl1").Rows.Count > 0 Then
      gd_feedback.DataSource = ds.Tables("tbl1").DefaultView
      gd_feedback.DataBind()
      gd_feedback.Visible = True
      gd_feedback.EnableViewState = True
    End If
  Catch ex As Exception
    Response.Write(ex.ToString)
  End Try
End Sub
Posted
Updated 24-Jan-11 19:54pm
v2
Comments
Indivara 25-Jan-11 1:55am    
and what is the problem? (you need to tell us)
Sandeep Mewara 25-Jan-11 2:40am    
Comment from OP:
its giving the error mentioned ie "invalid column name"
Mohd Wasif 25-Jan-11 2:19am    
Please give the structure of table

1 solution

The error message tells that one of the column you used in the procedure is not present in the table. Please check whether did you give all the column names correctly.
 
Share this answer
 
Comments
debo_india 25-Jan-11 2:05am    
i have checked it many times..still the error is coming!!
m@dhu 25-Jan-11 2:38am    
I think you didn't get what I said. Check strFeedTitle,strFeedNm,strFeedEmail,Mode and other columns are in the table you are using in the procedure.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900