[connection object creation]
Dim sSQL As String = "SELECT * FROM tPlayers"
Dim myAdapter As OleDbDataAdapter = New
OleDbDataAdapter(sSQL,myConnection)
Dim MyDataSet As New DataSet
myAdapter.Fill(MyDataSet)
GridView1.DataSource = MyDataSet
GridView1.DataBind()
myConnection.Close()
End Sub
I know the connection object is good because I use it else where, I have
edited out from the event above.
I have the require Namespaces , so it must be syntax, but I cannot for the
life of me see what the problem is.
Can anyone else?
GridView1.DataSource = MyDataSet.Tables[0];
A DataSet is a collection of DataTables.
You have to pick a Table.
"Paul W Smith" <p...@NOSPAM.twelve.me.uk> wrote in message
news:%23vRvD8D...@TK2MSFTNGP03.phx.gbl...
"Paul W Smith" <p...@NOSPAM.twelve.me.uk> wrote in message
news:%23vRvD8D...@TK2MSFTNGP03.phx.gbl...
"sloan" <sl...@ipass.net> wrote in message
news:eJVaQAED...@TK2MSFTNGP06.phx.gbl...
Are you or are you not getting a Syntax error.
Syntax errors are generated by the complier before the runtime errors.
Can you findout what you get from MyDataSet.Tables.count?
or MyDataSet.Tables[0].Rows[0].count
etc...
"Paul W Smith" <p...@NOSPAM.twelve.me.uk> wrote in message
news:%23vRvD8D...@TK2MSFTNGP03.phx.gbl...
string x = MyDataSet.GetXml();
or (vb.net)
dim x as string = MyDataSet.GetXml()
..
Look at the x value, and make sure you have information in there.
"sloan" <sl...@ipass.net> wrote in message
news:eJVaQAED...@TK2MSFTNGP06.phx.gbl...
>
>
> GridView1.DataSource = MyDataSet.Tables[0];
>
> A DataSet is a collection of DataTables.
Yes it is.
> You have to pick a Table.
No you don't - if the DataSet has only one table, you don't need to specify
it...
GridView1.DataSource = MyDataSet
--
Mark Rae
ASP.NET MVP
http://www.markrae.net
>> A DataSet is a collection of DataTables.
>>
>> You have to pick a Table.
> good catch, I did not see this one.
Makes no difference if the DataSet has only one Table...
> I have the require Namespaces , so it must be syntax, but I cannot for the
> life of me see what the problem is.
>
> Can anyone else?
You've forgotten the Command object...
Do you have to be an expert to use this forum or can beginners use it as
well!!!
I do appreciate your initial comments, as I have all the ones that have been
made, why you felt the need to advise me that 'knowing' what to do is faster
than asking seems strange to me.
Again thanks to everyone who took time to offer some advise - which I always
thought was the purpose of these forums.
PWS
"Peter Bromberg [C# MVP]" <pbro...@yahoo.yohohhoandabottleofrum.com> wrote
in message news:6C753DEE-22CC-4EF0...@microsoft.com...
..
"Paul W Smith" <p...@NOSPAM.twelve.me.uk> wrote in message
news:%23jtst4E...@TK2MSFTNGP02.phx.gbl...
I always like to try to help others where I can.
I have solved my problem, but I still do not understand it so perhaps
someone might assist me.
I am a little loathed to write this because it probably shows both my
inexperience and lack of knowledge, you can only get so much from
reading books, and I am not a ASP.NET professional, just a keen
amateur who codes in his spare time on small projects.
My problem which I discovered by trying to debug my code was that it
was not running. I am using Visual Studio 2005 and I noticed that
when in Source View "Client Objects and Events" was displayed, rather
than "Server Objects and Events." Unfortunately I looked in the drop
down and did not see "Server Objects and Events" so just opened a page
that did work and saved it with the new required name and amended the
code.
Thanks to everyone who tried to assist, your advice was apprecaited
and follwoing it helped me find my problem.
Live and learn with this stuff.
I'm a little unsure about what you've said, but I'll take a guess.
Look at the code of the aspx page (the html-ish type stuff, not the code
behind page).
CodeBehind="ManageUsers.aspx.vb"
Inherits="MyApplication.Presentation.Web1.ManageUsers"
When you do "copy and paste" stuff, sometimes this things get out of whack.
I'm probably way off, but thought I'd mention that one, since I was burned
by it early on.
"PWS" <p...@twelve.me.uk> wrote in message
news:1192178727.2...@y27g2000pre.googlegroups.com...
Now I remember that code which checks the "object" datasource, and you're
right, there is a
"If type is dataset and table.count = 1 then use the first table
(table[0])."
So I was off on this one, however it is good to know that if you have a
DataSet with more than 1 table, you need to specify the specific table of
interest.
"Mark Rae [MVP]" <ma...@markNOSPAMrae.net> wrote in message
news:OyIMlFED...@TK2MSFTNGP02.phx.gbl...