Home All Groups Group Topic Archive Search About
Author
10 Oct 2007 6:27 PM
Paul W Smith
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)


    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 string 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?

Author
11 Oct 2007 12:09 AM
Scott M.
Where's the connection object being created and configured?



Show quoteHide quote
"Paul W Smith" <pws@NOSPAM.twelve.me.uk> wrote in message
news:utp5X%232CIHA.1208@TK2MSFTNGP05.phx.gbl...
> Protected Sub Page_Load(ByVal sender As Object, ByVal e As
> System.EventArgs)
>
>
>    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 string 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?
>
>
>
Author
11 Oct 2007 6:26 AM
PWS
On Oct 11, 2:09 am, "Scott M." <s-...@nospam.nospam> wrote:
> Where's the connection object being created and configured?

I thought I made it clear that the connection object - myConnection is
tried and tested, as I use identical code to fill other dataobjects.
The lines that create and set this have been removed from my example.

The page actually runs but a blank web page is returned.
Author
11 Oct 2007 3:12 PM
Scott M.
All you said was that the connection string is good.  That doesn't tell us
that the connection object is good.  And since, for all we know, you might
be using the same string, but with different connection objects.




Show quoteHide quote
"PWS" <p**@twelve.me.uk> wrote in message
news:1192084013.808754.201490@50g2000hsm.googlegroups.com...
> On Oct 11, 2:09 am, "Scott M." <s-...@nospam.nospam> wrote:
>> Where's the connection object being created and configured?
>
> I thought I made it clear that the connection object - myConnection is
> tried and tested, as I use identical code to fill other dataobjects.
> The lines that create and set this have been removed from my example.
>
> The page actually runs but a blank web page is returned.
>
Author
11 Oct 2007 6:07 PM
Paul W Smith
I guess I am not clever enough to understand how either of your posts
answers my original question.

Perhaps someone else would like to try to assist me by explaining what I am
doing wrong.

PWS



Show quoteHide quote
"Scott M." <s-mar@nospam.nospam> wrote in message
news:OSF2JkBDIHA.2004@TK2MSFTNGP06.phx.gbl...
> All you said was that the connection string is good.  That doesn't tell us
> that the connection object is good.  And since, for all we know, you might
> be using the same string, but with different connection objects.
>
>
>
>
> "PWS" <p**@twelve.me.uk> wrote in message
> news:1192084013.808754.201490@50g2000hsm.googlegroups.com...
>> On Oct 11, 2:09 am, "Scott M." <s-...@nospam.nospam> wrote:
>>> Where's the connection object being created and configured?
>>
>> I thought I made it clear that the connection object - myConnection is
>> tried and tested, as I use identical code to fill other dataobjects.
>> The lines that create and set this have been removed from my example.
>>
>> The page actually runs but a blank web page is returned.
>>
>
>
Author
11 Oct 2007 8:40 PM
Scott M.
With responses like that, I guess you aren't clever enough to understand how
to pose a question that others would be able to respond to either.


Show quoteHide quote
"Paul W Smith" <pws@NOSPAM.twelve.me.uk> wrote in message
news:uhxlnGDDIHA.3712@TK2MSFTNGP02.phx.gbl...
>I guess I am not clever enough to understand how either of your posts
>answers my original question.
>
> Perhaps someone else would like to try to assist me by explaining what I
> am doing wrong.
>
> PWS
>
>
>
> "Scott M." <s-mar@nospam.nospam> wrote in message
> news:OSF2JkBDIHA.2004@TK2MSFTNGP06.phx.gbl...
>> All you said was that the connection string is good.  That doesn't tell
>> us that the connection object is good.  And since, for all we know, you
>> might be using the same string, but with different connection objects.
>>
>>
>>
>>
>> "PWS" <p**@twelve.me.uk> wrote in message
>> news:1192084013.808754.201490@50g2000hsm.googlegroups.com...
>>> On Oct 11, 2:09 am, "Scott M." <s-...@nospam.nospam> wrote:
>>>> Where's the connection object being created and configured?
>>>
>>> I thought I made it clear that the connection object - myConnection is
>>> tried and tested, as I use identical code to fill other dataobjects.
>>> The lines that create and set this have been removed from my example.
>>>
>>> The page actually runs but a blank web page is returned.
>>>
>>
>>
>
>
Author
12 Oct 2007 8:48 AM
PWS
Someone on another newsgroup suggested I post my resolution.  This
shows my inexperience and why I was such an easy target for  those who
presumably like to feel superior when someone with far less experience
and knoweldge asks for help.

Show quoteHide quote
> 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.
Author
12 Oct 2007 1:38 PM
Scott M.
What is "so superior" about asking your for you complete code and letting
you know why it was asked for?

Geeze, take the chip off your shoulder!  If you admit you are so
inexperienced, then perhaps you could have just responded to my second reply
with "oh, I didn't realize that if I just told you the connection string was
ok, that this wouldn't be enough to diagnose the problem."

The person who has the attitude here is you!  I was trying to help you
(until you brought your "just give me the answer and I don't need to answer
your questions" attittude to the table).

Show quoteHide quote
"PWS" <p**@twelve.me.uk> wrote in message
news:1192178919.899127.131360@y27g2000pre.googlegroups.com...
> Someone on another newsgroup suggested I post my resolution.  This
> shows my inexperience and why I was such an easy target for  those who
> presumably like to feel superior when someone with far less experience
> and knoweldge asks for help.
>
>> 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.
>
Author
16 Oct 2007 1:55 AM
Mark Fitzpatrick
Scotts right, even though you use a connection in one place and it works
fine there, that doesn't mean it will work right in all situations. I've
seen people accidentally use connections they have for a sql connection then
try to pass that to an oledb connection so that's why it's important. We've
also helped people that had connection string problems simply because they
used the wrong connection string name or spelling in their code and they
swore up and down that the connection string and the call to get it were
correct. Technically they were right, just misspelled their connection
string and it happens to the best of us which is why we ask.

Does the page run without any errors at all? Have you checked to see that
data is being returned? One think I often do with a dataset is use the
Trace.Write() method to output information about the dataset to the trace
file. Things like how many tables, the names of the tables and the number of
rows of each. If you can get this far then you can definitely see that data
is getting passed and know for sure that data retrieval works. When
something like this isn't working, the first thing I always try is dump some
message using Trace.Write just as soon as the event starts so I'm sure the
event is actually firing. Sometimes the event doesn't fire and it's easy to
end up running down a rathole looking for the wrong error.


--
Hope this helps,
Mark Fitzpatrick
Microsoft MVP - Expression

Show quoteHide quote
"Paul W Smith" <pws@NOSPAM.twelve.me.uk> wrote in message
news:utp5X%232CIHA.1208@TK2MSFTNGP05.phx.gbl...
> Protected Sub Page_Load(ByVal sender As Object, ByVal e As
> System.EventArgs)
>
>
>    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 string 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?
>
>
>
Author
16 Oct 2007 3:12 PM
PWS
Thanks Mark, I have actually solved my issue, it was along the lines
you mentioned, I was not actually getting anything in my DataSet.

I intend to experiment with the Trace command as I have no knoweldge
oir experience with this.  It should prove very helpful as you say for
testing purposes.

Can I ask another question here.....

How do I write text into the footer of my dataView?

I have tried all sorts of  variations on all sorts of things and
obviously I have not hit on the right combination of objects.

INitially I would like to be able to do something simple like:

GridView.FooterRow.Text = "Test message" (I know that does not work!)

But later I would like to have the text come from another Datatable in
my dataset.

Any assistance would be appreciated.

If I should postz this as a new thread please let me know.