Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > Using sqlDataAdapter to fill Dataset

Reply
Thread Tools

Using sqlDataAdapter to fill Dataset

 
 
Andy G
Guest
Posts: n/a
 
      01-31-2005
I am setting my adapter to the below value and then filling the dataset and
binding the data grid to that after I set my dataset equal to the datagrid's
datasource. I manual bind the fields of the query to the datagrid. Can I
set my sqlDataAdapter like this. It's choking on B.QSTN fields but finds
the first three. I SQL statement below works fine in my query analyzer.

SELECT A.PRSN_ID, A.LOGIN_NAME, A.ANSWER, B.QSTN, C.DESCR FROM
tblCFSPH_CM_LOGIN A INNER JOIN tblCFSPH_CM_PRSN_ROLE_LINK D ON A.PRSN_ID =
D.PRSN_ID INNER JOIN tblCFSPH_CM_ROLE C ON D.ROLE_ID = C.ROLE_ID LEFT JOIN
tblCFSPH_SECRT_QSTN B ON A.QSTN_ID = B.QSTN_ID

Thanks!


 
Reply With Quote
 
 
 
 
Elton Wang
Guest
Posts: n/a
 
      01-31-2005
Hi Andy,

If you only want to bind the first three fields in the
query to the datagrid, that's OK.

Set datagrid's AutoGenerateColumns to False

and set three BoundColumns in the datagrid like:

<Columns>
<asp:BoundColumn DataField="PRSN_ID" HeaderText="ID">
</asp:BoundColumn>
<asp:BoundColumn DataField="LOGIN_NAME"
HeaderText="Name">
</asp:BoundColumn>
<asp:BoundColumn DataField="ANSWER" HeaderText="Answer">
</asp:BoundColumn>
</Columns>

That will only bind three field in the datagrid.

Hope it helps,

Elton Wang
http://www.velocityreviews.com/forums/(E-Mail Removed)

>-----Original Message-----
>I am setting my adapter to the below value and then

filling the dataset and
>binding the data grid to that after I set my dataset

equal to the datagrid's
>datasource. I manual bind the fields of the query to the

datagrid. Can I
>set my sqlDataAdapter like this. It's choking on B.QSTN

fields but finds
>the first three. I SQL statement below works fine in my

query analyzer.
>
>SELECT A.PRSN_ID, A.LOGIN_NAME, A.ANSWER, B.QSTN, C.DESCR

FROM
>tblCFSPH_CM_LOGIN A INNER JOIN tblCFSPH_CM_PRSN_ROLE_LINK

D ON A.PRSN_ID =
>D.PRSN_ID INNER JOIN tblCFSPH_CM_ROLE C ON D.ROLE_ID =

C.ROLE_ID LEFT JOIN
>tblCFSPH_SECRT_QSTN B ON A.QSTN_ID = B.QSTN_ID
>
>Thanks!
>
>
>.
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Does SqlDataAdapter.Fill() always close the connection? M ASP .Net 7 02-07-2009 04:45 AM
Using SQLDataSource to fill a datatable or dataset tom c ASP .Net 1 09-16-2006 05:17 PM
how to fill a dataset using something OTHER than a SQL query? darrel ASP .Net 5 05-06-2005 02:12 AM
TimeOut on SqlDataAdapter.Fill Dan ASP .Net 1 04-02-2004 11:05 PM
How to update the Database by using SqlDataAdapter object in asp.net? zhaoJian ASP .Net 0 11-06-2003 03:06 AM



Advertisments