473,386 Members | 1,702 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Data grid not populating in ASP.NEt

Hi
I have two drop downs and abutton, the button is supposed to send one of the items from one of the dropdowns to a qry (access database) and populate the datagrid with the info. It is not working propery- I press the button and it LOOKS Like something happens- but the datagrid does not populate.
I am not really sure how to troubleshoot this part... I can successfully pull data from the table without sending something to the WHERE... (like a select *) and populate the grid..

Sub Page_load(Sender As Object, Byval E As EventArgs)
If Not Page.IsPostBack Then
Dropdownlist1.DataTextField = "CompanyName"
Dropdownlist1.dataValueField= "ShipperID"
DropDownList1.DataSource = GetShippers()
DropDownList1.DataBind()
Label2.text=DropDownList1.selecteditem.value
End If
End Sub

Sub getlabel(byval sender As Object, ByVal e As EventArgs)
Label2.text=DropDownList1.selecteditem.value
End Sub

SUB Button1_click(byval sender As Object, ByVal e As EventArgs)
Call GETORDER()
datagrid1.visible=true
End Sub

FUNCTION GetShippers() As System.Data.DataSet
Dim connectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0; Ole DB Services=-4; Data Source=C:\WEB_STUFF\AS"& _
"P\Northwind.mdb"
Dim dbConnection As System.Data.IDbConnection = New System.Data.OleDb.OleDbConnection(connectionString )
Dim queryString As String = "SELECT [Shippers].[ShipperID],[Shippers].[Companyname] FROM [Shippers]"
Dim dbCommand As System.Data.IDbCommand = New System.Data.OleDb.OleDbCommand
dbCommand.CommandText = queryString
dbCommand.Connection = dbConnection
Dim dataAdapter As System.Data.IDbDataAdapter = New System.Data.OleDb.OleDbDataAdapter
dataAdapter.SelectCommand = dbCommand
Dim dataSet As System.Data.DataSet = New System.Data.DataSet
dataAdapter.Fill(dataSet)
Return dataSet
End FUNCTION

FUNCTION GETORDER()
Dim connectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0; Ole DB Services=-4; Data Source=C:\WEB_STUFF\AS"& _
"P\Northwind.mdb"
Dim dbConnection As System.Data.IDbConnection = New System.Data.OleDb.OleDbConnection(connectionString )

dim ShipVia = DropDownList1.selecteditem
Dim queryString As String = "SELECT [Orders].[OrderDate], [Orders].[ShipAddress] FROM [Orders] WHERE ([Orders]"& _
".[ShipVia] = " & ShipVia & ")"
Dim dbCommand As System.Data.IDbCommand = New System.Data.OleDb.OleDbCommand
dbCommand.CommandText = queryString
dbCommand.Connection = dbConnection

Dim dataAdapter As System.Data.IDbDataAdapter = New System.Data.OleDb.OleDbDataAdapter
dataAdapter.SelectCommand = dbCommand
Dim DSet As System.Data.DataSet = New System.Data.DataSet
dataAdapter.Fill(DSet)
DataGrid1.DataSource = dset
DataGrid1.DataBind()
return dset

End FUNCTION
Nov 29 '06 #1
0 1141

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: kk | last post by:
Have 2 problems, any help is appreciated. Tab with Grids -------------- BL - fetching data from DB ( 5 secs - 10 rows) Grid Laod - 20 secs Grid Paint on tab change - 20 secs Problem: The...
6
by: Mike Kirkpatrick | last post by:
I have this data grid which consists of 3 pick lists. The first pick list is to affect the data binding of the other two. I have figured out how to do the data binding by column. However, I do not...
0
by: Nick | last post by:
Hi, * I have established an ODBC connection to an interbase 5.6 .gdb file. * I have executed a query on the database and put the returned query data into a data grid. The reason I copy the...
2
by: Joe Au | last post by:
I follow the Walkthrough documented on Visual Studio to create an editable data grid but it does not work on getting the value of the textbox in the data grid. The code is copied here. I mark...
6
by: Hutty | last post by:
I've looked around and have yet to find anything that would answer my question regarding formating a column in a datagrid. My grid looks like this as far as data" AMHQCON|51300.01|-3147 The...
6
by: Tejpal Garhwal | last post by:
I have datagrid filled with some data rows. At the run time i want know how many total rows are there in the data grid ? Any idea ? Any Suggestions ? Thanks in advance Tej
2
by: Parveen | last post by:
I have a data grid that's bound to a table in my dataset. After inserting a new row into the grid and populating it with data, I go to save my changes. My data adapter update command returns an...
0
by: Eric B. | last post by:
I am populating a DataGrid with many rows. As it is populating I see the scrollbar flying but no rows pop up until it is finished. Is there a way to make each row draw as soon as it is...
0
by: pragadheesh | last post by:
I have a TAB where a data grid gets displayed. I want to access the elements of the datagrid. but i'm getting the following error. "Data cannot be read from a DataGrid which is not bound to a...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.