Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jan 20th, 2007, 10:11 PM   #1
King
Professional Programmer
 
King's Avatar
 
Join Date: Jan 2006
Location: Ontario, Canada
Posts: 372
Rep Power: 0 King is an unknown quantity at this point
System.Data

In Visual Studio 2003 I could run the following statement:
cmdUser.Parameters.Add("@firstname", SqlDbType.VarChar, 25).Direction = ParameterDirection.Output;
But now in VS2005 it won't compile because it doesn't know what SqlDbType and ParameterDirection are. If I add the System.Data. in front of SqlDbType and ParameterDirection it will work fine. Is VS2005 supposed to behaving like this, or am I missing something?

Thanks.
__________________
I am Addicted to Linux!
King is offline   Reply With Quote
Old Jan 20th, 2007, 10:47 PM   #2
Samuaijack
Programmer
 
Samuaijack's Avatar
 
Join Date: Jul 2006
Location: using Earth.Africa.Egypt.Cairo;
Posts: 71
Rep Power: 3 Samuaijack is on a distinguished road
i didn't play with VS 2005 but i think what you should do is to write (using System.Data.SqlClient).
Samuaijack is offline   Reply With Quote
Old Jan 20th, 2007, 10:58 PM   #3
King
Professional Programmer
 
King's Avatar
 
Join Date: Jan 2006
Location: Ontario, Canada
Posts: 372
Rep Power: 0 King is an unknown quantity at this point
I have done that...
__________________
I am Addicted to Linux!
King is offline   Reply With Quote
Old Jan 21st, 2007, 12:18 AM   #4
xavier
Professional Programmer
 
xavier's Avatar
 
Join Date: Oct 2004
Location: .ro
Posts: 381
Rep Power: 4 xavier is on a distinguished road
Send a message via Yahoo to xavier
I have these 2 inclusions

using System.Data;
using System.Data.SqlClient;

and this:

cmd.Parameters.Add("@asd",SqlDbType.VarChar,25).Direction = ParameterDirection.Output;

compiles fine.
__________________
Don't take life too seriously, it's not permanent !
xavier is offline   Reply With Quote
Old Jan 21st, 2007, 1:10 AM   #5
PhilBon
Hobbyist Programmer
 
PhilBon's Avatar
 
Join Date: Nov 2005
Posts: 172
Rep Power: 3 PhilBon is on a distinguished road
Send a message via AIM to PhilBon Send a message via MSN to PhilBon
Maybe I can Give you some background info. What I have found is that you have to be more explicit about what Libraries you want the compiler to use. Cause I to had this kind of problem. Best thing to figure out what you need is put in what you think:
cmdUser.Parameters.Add("@firstname", SqlDbType.VarChar, 25).Direction = ParameterDirection.Output;
and then mouse over it or right click (I can't remember) and it should say "Change To:..." and in front of the cmdUser should be the library that you need. So this would be System.Data if that is what it's part of (I didn't run it to check). If you are only going to use the Library once I think you should leave it to System.Data.cmdUser because then it might lessen the compile time. One thing to know, I did this in Visual Basic .Net 2005 so I'm not 100% sure if it will work with C# but I'm pretty sure because it's the same IDE.
PhilBon is offline   Reply With Quote
Old Jan 21st, 2007, 2:56 AM   #6
King
Professional Programmer
 
King's Avatar
 
Join Date: Jan 2006
Location: Ontario, Canada
Posts: 372
Rep Power: 0 King is an unknown quantity at this point
OK I fixed it. I just closed down my project and re-opened it and it compiled fine... very weird.

Thanks for the input guys.
__________________
I am Addicted to Linux!
King is offline   Reply With Quote
Old Jan 21st, 2007, 5:44 AM   #7
Arevos
Programming Guru
 
Arevos's Avatar
 
Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 5 Arevos is on a distinguished road
Quote:
Originally Posted by King View Post
OK I fixed it. I just closed down my project and re-opened it and it compiled fine... very weird.
Yeah, Visual Studio 2003 has these little moments as well, and SQL Server 2005 very occassionally also manages to screw itself up. Just remember you're dealing with Microsoft products, which whilst feature-packed, might not be always consistent and stable.
Arevos is offline   Reply With Quote
Old Jan 21st, 2007, 10:25 AM   #8
milot
Programmer
 
milot's Avatar
 
Join Date: Nov 2006
Location: Kosovė/Prishtinė
Posts: 47
Rep Power: 0 milot is on a distinguished road
Did you tried adding System.Data.Common in using directives and try
CSharp Syntax (Toggle Plain Text)
  1. cmdUser.Parameters.AddWithValue()
milot is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 7:33 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC