Hello. For some reason, I am able to "connect" to the Northwind
database whenever I use the wizard; however, when I run the
application, my datagrid does not display. Here are the exact steps I
am taking to try to get this to run:
1)New Project -->ASP.NET Application
2) From the Server Explorer, drag the Northwind Employees table onto
the WebForm1.aspx design view. SqlConnection1 and SqlDataAdapter1 are
created.
3) From the Toolbox, drag the Datagrid control onto the WebForm1.aspx
web page.
4) Click on SqlDataAdapter1 box, select "Configure Data Adapter," and
fill out the settings for my server -- server name is the only one,
check "Use Windows Integrated Security," select the Northwind database,
and click on Test Connection. Succeeded. (Funny thing: On the
"Advanced" tab, none of the permissions are checked and I can't change
them.)
5)Click next and select "Use SQL Statements" for the rest of the
wizard.
6) Keep standard query generated out of the Employees table. ("SELECT
EmployeeID, LastName, FirstName, Title, TitleOfCourtesy, BirthDate,
HireDate, Address, City, Region, PostalCode, Country, HomePhone,
Extension, Photo, Notes, ReportsTo, PhotoPath FROM Employees")
7) Finish.
8)Click on Generate Dataset. It creates Dataset11.
9) Click on the Datagrid and use the dropdown in "Datasource" to select
Dataset11.
RUN.
The explorer page is blank, even though I can see the column names in
the DESIGN mode. What is going on?
Cindy 2 2200
You need to fill your dataset.
By default, a data adapter does not fill a dataset. The "Generate
Dataset" you are talking about only creates a dataset with "Strongly
Typed" tables and columns, which means your dataset has strong names
for the data in it.
To fill your dataset with data, go to the page_load event and insert
the code:
sqldataAdapter1.Fill(dataset11) ' VB, change for c#
datagrid1.Databind() ' This line ensures that every page load causes
the data to bind to the datagrid
Ideally you would wrap the above 2 lines of code in:
if Not Page.IsPostback then
end if
This is because your datagrid might use paging. There's a walkthrough
on datagrids in MSDN help. You need to do a little more work to get
paging to work, but not much.
Steve
Cindy wrote:
Hello. For some reason, I am able to "connect" to the Northwind
database whenever I use the wizard; however, when I run the
application, my datagrid does not display. Here are the exact steps I
am taking to try to get this to run:
1)New Project -->ASP.NET Application
2) From the Server Explorer, drag the Northwind Employees table onto
the WebForm1.aspx design view. SqlConnection1 and SqlDataAdapter1 are
created.
3) From the Toolbox, drag the Datagrid control onto the WebForm1.aspx
web page.
4) Click on SqlDataAdapter1 box, select "Configure Data Adapter," and
fill out the settings for my server -- server name is the only one,
check "Use Windows Integrated Security," select the Northwind database,
and click on Test Connection. Succeeded. (Funny thing: On the
"Advanced" tab, none of the permissions are checked and I can't change
them.)
5)Click next and select "Use SQL Statements" for the rest of the
wizard.
6) Keep standard query generated out of the Employees table. ("SELECT
EmployeeID, LastName, FirstName, Title, TitleOfCourtesy, BirthDate,
HireDate, Address, City, Region, PostalCode, Country, HomePhone,
Extension, Photo, Notes, ReportsTo, PhotoPath FROM Employees")
7) Finish.
8)Click on Generate Dataset. It creates Dataset11.
9) Click on the Datagrid and use the dropdown in "Datasource" to select
Dataset11.
RUN.
The explorer page is blank, even though I can see the column names in
the DESIGN mode. What is going on?
Cindy
Thanks! That worked perfectly! le*********@hotmail.com wrote:
You need to fill your dataset.
By default, a data adapter does not fill a dataset. The "Generate
Dataset" you are talking about only creates a dataset with "Strongly
Typed" tables and columns, which means your dataset has strong names
for the data in it.
To fill your dataset with data, go to the page_load event and insert
the code:
sqldataAdapter1.Fill(dataset11) ' VB, change for c#
datagrid1.Databind() ' This line ensures that every page load causes
the data to bind to the datagrid
Ideally you would wrap the above 2 lines of code in:
if Not Page.IsPostback then
end if
This is because your datagrid might use paging. There's a walkthrough
on datagrids in MSDN help. You need to do a little more work to get
paging to work, but not much.
Steve
Cindy wrote:
Hello. For some reason, I am able to "connect" to the Northwind
database whenever I use the wizard; however, when I run the
application, my datagrid does not display. Here are the exact steps I
am taking to try to get this to run:
1)New Project -->ASP.NET Application
2) From the Server Explorer, drag the Northwind Employees table onto
the WebForm1.aspx design view. SqlConnection1 and SqlDataAdapter1 are
created.
3) From the Toolbox, drag the Datagrid control onto the WebForm1.aspx
web page.
4) Click on SqlDataAdapter1 box, select "Configure Data Adapter," and
fill out the settings for my server -- server name is the only one,
check "Use Windows Integrated Security," select the Northwind database,
and click on Test Connection. Succeeded. (Funny thing: On the
"Advanced" tab, none of the permissions are checked and I can't change
them.)
5)Click next and select "Use SQL Statements" for the rest of the
wizard.
6) Keep standard query generated out of the Employees table. ("SELECT
EmployeeID, LastName, FirstName, Title, TitleOfCourtesy, BirthDate,
HireDate, Address, City, Region, PostalCode, Country, HomePhone,
Extension, Photo, Notes, ReportsTo, PhotoPath FROM Employees")
7) Finish.
8)Click on Generate Dataset. It creates Dataset11.
9) Click on the Datagrid and use the dropdown in "Datasource" to select
Dataset11.
RUN.
The explorer page is blank, even though I can see the column names in
the DESIGN mode. What is going on?
Cindy
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: DelphiBlue |
last post by:
I have a Nested Datagrid that is using a data relations to tie the parent
child datagrids together. All is working well with the display but I am
having some issues trying to sort the child...
|
by: Diego TERCERO |
last post by:
Hi...
I'm working on a tool for editing text resources for a family of software
product my company produces.
These text resources are found in a SQL Server database, in a table called...
|
by: PeterZ |
last post by:
G'day,
After doing much searching and pinching bits of ideas from here there and
everywhere I came up with a fairly 'clean' solution of including a comboBox
into a dataGrid column.
You can...
|
by: pei_world |
last post by:
I want to implement a key hit with enter to dropdown a combobox that is in
the datagrid. in this case I need to override its original behaviours. I
found some codes from the web. Does anyone know...
|
by: Kumar |
last post by:
Hi Folks,
I have a question regarding conditional hyperlink in datagrid.
I want to display Hyperlink if my QID values in (1,4,5,6) other wise i
want to display just Qdescription with out...
|
by: nfedin |
last post by:
I am trying to use a datagrid to display/edit some database
information. I would like to use the datagrids inherent edit
capabilities to do it. I have setup the datagrid to display the data...
|
by: simon |
last post by:
hello,
new to vb.net, have a few questions about DataGrid. I have a dataGrid
that is working pulling a dataset back from a stored proc and binding
to the datagrid for display
the datagrid's...
|
by: rn5a |
last post by:
In my application, I want to populate all the directories & files
existing in a directory on the server in a DataGrid. To ensure that
all the directories get listed first followed by all the files,...
|
by: Mark B |
last post by:
I have a Datagrid working fine, outputting:
Group
Most Popular Product Code
--------
-------------------------------
Earth.New Zealand
32
Earth.New Zealand
|
by: Mark B |
last post by:
Can someone write some VB.Net example code for me that does this:
1) Creates a gridview control with the results of a SQL stored procedure
that has 1 parameter (text)
2) Adds an extra column...
|
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$) {
}
...
|
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...
|
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
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
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...
| |