Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / April 2005

Tip: Looking for answers? Try searching our database.

Stored Procedure Newbie needs help

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Brian Kitt - 29 Apr 2005 01:20 GMT
Trying to do a stored procedure in C# against Microsoft Access.  I just want
to do a simple select to do a lookup.  Unfortunately all of the examples I
can find are for SQL 2000 Server, and they don't seem to work in Access.  I
am very familiar with Data Adapters and passing parms that way.  I just am
stuck trying to create the stored procedure in Access because I can't get the
Parameter syntax right.  It keeps returning a Parameter Syntax Error.

OleDbCommand createCMD  = new OleDbCommand();
createCMD.Connection = myConn;
createCMD.CommandText = "CREATE PROCEDURE GetResident " +
"(@ResidentNo int,  " +
"@ResidentName char(25) OUTPUT,  " +
"@ResidentCity char(25) OUTPUT) " +
"AS " +
"SELECT ResidentName, ResidentCity FROM RESIDENT " +
"WHERE ResidentNo = @ResidentNo";
createCMD.ExecuteNonQuery();
aaj - 29 Apr 2005 12:01 GMT
I'm not sure that Access supports stored procedures

As far as I remember it has QUERIES that are similar to VIEWS  and you might
be able to use these its place, but no equivelent to TSQL

I might be wrong, but its worth a check before you go any further

Andy

> Trying to do a stored procedure in C# against Microsoft Access.  I just
> want
[quoted text clipped - 16 lines]
> "WHERE ResidentNo = @ResidentNo";
> createCMD.ExecuteNonQuery();
aaj - 29 Apr 2005 12:06 GMT
Sorry, it would seem it does now, learn something new every day!!

http://www.devcity.net/Articles/18/msaccess_sp.aspx

gives some Vb.net example, perhaps thay might be of use?

> I'm not sure that Access supports stored procedures
>
[quoted text clipped - 27 lines]
>> "WHERE ResidentNo = @ResidentNo";
>> createCMD.ExecuteNonQuery();
Brian Kitt - 29 Apr 2005 18:04 GMT
Aha, there is a caveat there that says 'Output parameters are not supported'.
That is where my Stored Procedure keeps blowing up.  So that's what my
problem is.

> Trying to do a stored procedure in C# against Microsoft Access.  I just want
> to do a simple select to do a lookup.  Unfortunately all of the examples I
[quoted text clipped - 13 lines]
> "WHERE ResidentNo = @ResidentNo";
> createCMD.ExecuteNonQuery();

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.