0

hi frnds,,,,
here i want to access the data base and showing in the grid view without help of datasourse it will shows the error,


the error is "The IListSource does not contain any data sources""
here my coding is as follows.....

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
Call fillgrid()
End If
End Sub
Private Sub fillgrid()
Dim connstr As String
connstr = ConfigurationManager.ConnectionStrings("guest1").ConnectionString()
Dim conn As New SqlConnection(connstr)
Dim adp As SqlDataAdapter
Dim ds As New DataSet
conn.Open()
adp = New Data.SqlClient.SqlDataAdapter("select convert(varchar,dae_of_arr,103) as 'ARRIVALDATE' , convert(varchar,dae_of_DEPT,103) as 'DEPARTUREDATE',convert(varchar,datediff(dd,daye_of_arr,date_of_dept),103) as 'DAYS' WHERE date_of_arr='" + arrivaldate.Text + "' ", conn)

GridView1.DataSource = ds
GridView1.DataBind()
GridView1.Dispose()
conn.Close()

End Sub

here iam using asp.net with vb.net

database is sqlserver-2005...........

3
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by jbisono
0

yes jbisono is right.

above this line GridView1.DataSource = ds you are missing this one adp.Fill(ds)

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.