all groups > asp.net datagrid control > october 2007 >
You're in the

asp.net datagrid control

group:

Why Does This Not Work?


Re: Why Does This Not Work? Scott M.
10/10/2007 8:09:35 PM
asp.net datagrid control:
Where's the connection object being created and configured?



[quoted text, click to view]

Why Does This Not Work? Paul W Smith
10/10/2007 8:27:17 PM
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?


Re: Why Does This Not Work? PWS
10/10/2007 11:26:53 PM
[quoted text, click to view]

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.
Re: Why Does This Not Work? Scott M.
10/11/2007 11:12:47 AM
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.




[quoted text, click to view]

Re: Why Does This Not Work? Scott M.
10/11/2007 4:40:45 PM
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.


[quoted text, click to view]

Re: Why Does This Not Work? Paul W Smith
10/11/2007 8:07:53 PM
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



[quoted text, click to view]

Re: Why Does This Not Work? PWS
10/12/2007 1:48:39 AM
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.

[quoted text, click to view]
Re: Why Does This Not Work? Scott M.
10/12/2007 9:38:48 AM
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).

[quoted text, click to view]

Re: Why Does This Not Work? Mark Fitzpatrick
10/15/2007 8:55:19 PM
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

[quoted text, click to view]

Re: Why Does This Not Work? PWS
10/16/2007 8:12:44 AM
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.
Why Does This Not Work? mnn8@gmail.com
2/5/2008 4:19:30 PM
Hi,
What's is the error your're getting?
AddThis Social Bookmark Button