Click here to Skip to main content
15,907,497 members

Comments by Ashok Sharma (Top 2 by date)

Ashok Sharma 21-Jan-14 11:02am View    
After adding GridView1.DataBind() at the end of the code this got resolved.

Thanks a lot....
Ashok Sharma 9-Jan-14 12:28pm View    
Thanks Tejas, mine error is also got resolved however gridview isn't visible, any suggestion? I haven't set any visible property.
Here is the code.

Dim sqlCnn As SqlConnection
Dim sqlCmd As SqlCommand
Dim sql As String
Dim sda As SqlDataAdapter

Dim connectionString As String = "Data Source=THERAIN\SQLEXPRESS;Initial Catalog=Ashok;User ID=sa;Password=Ashok"
sqlCnn = New SqlConnection(connectionString)
sql = "SELECT * FROM Income WHERE date>='" + TextBox1.Text.ToString + "' and date<='" + TextBox2.Text.ToString + "'"

sda = New SqlDataAdapter(sql, sqlCnn)

sqlCnn.Open()

Dim ds As New DataSet

Dim commandBuilder As SqlCommandBuilder = New SqlCommandBuilder(sda)

sda.Fill(ds)
GridView1.DataSource = ds.Tables(0)
sqlCnn.Close()