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...........

Recommended Answers

All 3 Replies

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

yes jbisono is right.

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

We glad to hear that :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.