Please tell me what I'm doing wrong.
check that if the dataset is populated when there is no PostBack.
Public Overloads Function GetBookInfo() As DataSet
Dim oPubConnection As SqlConnection
Dim SConnString As String
Dim osqlCommPubs As SqlCommand
Dim osqlCommTitles As SqlCommand
Dim oDataAdapterPubs As SqlDataAdapter
Dim oDataAdapterTitles As SqlDataAdapterTry
SConnString = "Data Source=(local);Initial Catalog=Pubs;" & _
"User ID=sa;Password=;"
oPubConnection = New SqlConnection(SConnString)
oPubConnection.Open()'Create command to retrieve pub info
osqlCommPubs = New SqlCommand
osqlCommPubs.Connection = oPubConnection
osqlCommPubs.CommandText = "Select Pub_ID, Pub_Name from Publishers"'Create Data Adapter for pub info
oDataAdapterPubs = New SqlDataAdapter
oDataAdapterPubs.SelectCommand = osqlCommPubs'Create command to retrieve title info
osqlCommTitles = New SqlCommand
osqlCommTitles.Connection = oPubConnection
osqlCommPubs.CommandText = "select Pub_ID, title, price, ytd_sales from titles"'Create data adapter for title info
oDataAdapterTitles = New SqlDataAdapter
oDataAdapterTitles.SelectCommand = osqlCommTitles'Create and fill a data set
Dim datBookInfo As DataSet = New DataSet
oDataAdapterPubs.Fill(datBookInfo, "Publishers")
oDataAdapterTitles.Fill(datBookInfo, "Titles")
Return datBookInfoCatch ex As Exception
Finally
oPubConnection.Close()End Try
End Function
If(!Page.IsPostBack)
{
LoadData();
}
Hmm, dont see anything obvious...How are you doing your bind of the dataset to the grid?
Also, since this is a windows project and not a web project (assuming your "I've created a vb windows application" is correct) there will NOT be a page.isPostBack...
Thanks,
MajorCats
0 comments:
Post a Comment