executereader fails with sqlclient

  • Thread starter Thread starter Mortar
  • Start date Start date
M

Mortar

i have the following code:

SqlConnection con = new
SqlConnection("server=myserver;database=myDB;uid=aa;password=aa;");
SqlCommand cmd = new SqlCommand(SQL, con);
con.Open();

dgResults.DataSource = cmd.ExecuteReader();
dgResults.DataBind();

This uses SqlClient and fails on the executereader line. What am I
doing wrong? The code works if I use OleDB.
 
And can you also post the way in which it fails. I Assume its an exception so can you post the exception trace

Regards

Ricard Blewett - DevelopMentor
http://staff.develop.com/richardb/weblog

nntp://news.microsoft.com/microsoft.public.dotnet.languages.csharp/<#[email protected]>

Where is the sql statement ? Can you post it too?

with regards,


J.V.Ravichandran
- http://www.geocities.com/
jvravichandran
- http://www.411asp.net/func/search?
qry=Ravichandran+J.V.&cob=aspnetpro
- http://www.southasianoutlook.com
- http://www.MSDNAA.Net
- http://www.csharphelp.com
- http://www.poetry.com/Publications/
display.asp?ID=P3966388&BN=999&PN=2
- Or, just search on "J.V.Ravichandran"
at http://www.Google.com



---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.766 / Virus Database: 513 - Release Date: 17/09/2004



[microsoft.public.dotnet.languages.csharp]
 
Back
Top