Article Options
Recently Viewed
Premium Sponsor
Premium Sponsor

 »  Home  »  Data Programming  »  Working with MS Access Stored Procedures in VB.NET. Part 2
 »  Home  »  Data Programming  »  Microsoft Access  »  Working with MS Access Stored Procedures in VB.NET. Part 2
Working with MS Access Stored Procedures in VB.NET. Part 2
by David Wasserman | Published  04/18/2002 | Data Programming Microsoft Access | Rating:
David Wasserman

David Wasserman is a Senior Software Developer residing in Toronto, Canada. He has over 10 years industry experience in a vast array of technologies and programming languages. David has also consulted for many companies in the banking, retail and communications industries via Grand Solutions Consulting Inc, where he is Vice-President. In recent years, David's focus has been working with Microsoft technologies, including Visual Basic, VB.NET, C#, ASP, ASP .NET, SQL Server and MS Access development. David can be reached at david@grandconsult.com.

 

View all articles by David Wasserman...
Working with MS Access Stored Procedures in VB.NET. Part 2

Article source code: msaccess_sp2.zip

Introduction

Welcome to part two of Access Stored Procedures. Part one described in detail how to create stored procedures in Access using ADO.NET and Visual Basic.NET. Part two will demonstrate how to utilize the stored procedures created in part one by assembling a Database Tier that can be modelled and used in your own applications. This article will describe in detail one implementation of a Database Tier for Visual Basic.NET.

The main purpose of the Database Tier is to provide a gateway to the database via a class module. This class module would act as the glue between the database and the application. There are two main advantages to using a data tier to access your database. You will have the ability to modify your underlying database technology (moving from MS Access to SQL Server for instance) without affecting your application in a major way. You will also be placing a control layer between your application and the database allowing you to ensure that all data is properly "cleansed". The Database Tier in .NET applications would most likely consist of a class module keeping in line with proper object-oriented coding conventions. Earlier versions of Visual Basic would employ a Standard Module to do the job.

Database Tier - Code

It's now time to roll up our sleeves and get dirty with some code. The first thing after adding an empty class declaration file is to pull in the proper .NET Framework libraries listed below.

Imports System
Imports System.Data
Imports System.Data.OleDb

The System Library is standard for most applications, and I make it a habit to include it in almost all my code modules. The System.Data library is necessary for almost all database access applications. The System.Data.OleDb is used specifically for OLEDB Database Providers to which Microsoft Access belongs to. If we were using SQL Server we'd include the custom SQL provider System.Data.SqlClient.

Then next line of code starts the definition of the Class:

Public Class DBTier

Here we've named the Class DBTier and have given it a modifier of Public, thus making it very accessible from other code modules. After the class is defined all properties are declared:

Shared connectionString As String = _
    "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Program " _
    & "Files\Microsoft Office\Office10\Samples\Northwind.mdb"

Only one property is declared here as a string variable, connectionString. This variable holds the connection string for the Northwind Access Database. Declaring the variable as Shared defines it as "Class Variable". A class variable is associated with the class, not each object instantiated from the class.

After the connection string declaration you'll find there are three subroutines and one function. The function returns a dataset with a listing of all products. It calls the stored procedure procProductsList, created in part one of this article.

Next you'll find the three subroutines. There is one for each stored procedure; add, update and deletion of products. They're all similarly structured; each with a command, connection and required parameter(s) declared. As a sample, let's dissect the ProductsDeleteItem subroutine. After understanding how this subroutine works the others should be easy to digest.

To start off the routine takes in one parameter, ProductID, which is an Integer representing the Product to be deleted.

Sub ProductsDeleteItem(ByVal ProductID As Integer)

Next, all variables are declared. One for the connection, command and a parameter to be passed into the stored procedure. This parameter is the ProductID to be deleted.

Dim con As OleDbConnection
Dim cmd As OleDbCommand = New OleDbCommand()
Dim paramProductID As New OleDbParameter()

Command and connection objects are initialized:

con = New OleDbConnection(connectionString)
cmd.Connection = con

The paramProductID parameter properties are configured. Then the parameter is added to the command object. In this case the parameter name in the stored procedure is inProductID, it's an integer and the value is set to the ProductID passed into this subroutine.

With paramProductID
    .ParameterName = "inProductID"
    .OleDbType = OleDbType.Integer
    .Size = 4
    .Value = ProductID
End With
cmd.Parameters.Add(paramProductID)

The last part actually calls the stored procedure.

cmd.CommandText = "EXECUTE procProductsDeleteItem"
con.Open()
cmd.ExecuteNonQuery()
con.Close()

Notice that the connection object only stays open long enough to carry out the stored procedure and then closes immediately. This reduces any possible contention.

While the DBTier class included in this article clearly describes how to access the stored procedures, it would need some enhancements to become quality production code since no error handling has been added. There may also be the need to further enhance performance here.

The downloaded source code associated with this article includes the DBTier.vb file along with some very basic forms to test the actual implementation of the class.

In conclusion, I hope you have gained at least two things from these articles. One being that stored procedures are alive and well in Microsoft Access, although not without their limitations. The second thing to walk away with here is understanding the need to break down an application's data access into separate classes, subroutines and functions. This makes maintenance and upgrades much easier to implement.

Entire DBTier.vb source code:

Imports System
Imports System.Data
Imports System.Data.OleDb

' Functions and subroutines for executing Stored Procedures in Access.
Public Class DBTier

    ' Change Data Source to the location of Northwind.mdb on your local 
    ' system.
    Shared connectionString As String = _
        "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Program " _
        & "Files\Microsoft Office\Office10\Samples\Northwind.mdb"
    ' This function returns a dataset containing all records in
    ' the Products Table.
    Function ProductsList() As DataSet
        Dim con As OleDbConnection
        Dim da As OleDbDataAdapter
        Dim ds As DataSet
        Dim sSQL As String


        sSQL = "EXECUTE procProductsList"

        con = New OleDbConnection(connectionString)
        da = New OleDbDataAdapter(sSQLcon)
        ds = New DataSet()
        da.Fill(ds"Products")

        Return ds

    End Function

    ' This Function adds one record to the Products table.
    Sub ProductsAddItem(ByVal ProductName As String_
        ByVal SupplierID As IntegerByVal CategoryID As Integer)
        Dim con As OleDbConnection
        Dim cmd As OleDbCommand = New OleDbCommand()
        Dim paramProductName As New OleDbParameter()
        Dim paramSupplierID As New OleDbParameter()
        Dim paramCategoryID As New OleDbParameter()

        con = New OleDbConnection(connectionString)
        cmd.Connection = con

        With paramProductName
            .ParameterName = "inProductName"
            .OleDbType = OleDbType.VarChar
            .Size = 40
            .Value = ProductName
        End With
        cmd.Parameters.Add(paramProductName)

        With paramSupplierID
            .ParameterName = "inSupplierID"
            .OleDbType = OleDbType.Integer
            .Size = 4
            .Value = SupplierID
        End With
        cmd.Parameters.Add(paramSupplierID)

        With paramCategoryID
            .ParameterName = "inCategoryID"
            .OleDbType = OleDbType.Integer
            .Size = 4
            .Value = CategoryID
        End With
        cmd.Parameters.Add(paramCategoryID)

        cmd.CommandText = "EXECUTE procProductsAddItem"
        con.Open()
        cmd.ExecuteNonQuery()
        con.Close()

    End Sub

    ' This function Updates a specific JobTitle Record with new data.
    Sub ProductsUpdateItem(ByVal ProductID As Integer_
        ByVal ProductName As String)
        Dim con As OleDbConnection
        Dim cmd As OleDbCommand = New OleDbCommand()
        Dim paramProductName As New OleDbParameter()
        Dim paramProductID As New OleDbParameter()

        con = New OleDbConnection(connectionString)
        cmd.Connection = con

        With paramProductID
            .ParameterName = "inProductID"
            .OleDbType = OleDbType.Integer
            .Size = 4
            .Value = ProductID
        End With
        cmd.Parameters.Add(paramProductID)

        With paramProductName
            .ParameterName = "inProductName"
            .OleDbType = OleDbType.VarChar
            .Size = 40
            .Value = ProductName
        End With
        cmd.Parameters.Add(paramProductName)

        cmd.CommandText = "EXECUTE procProductsUpdateItem"
        con.Open()
        cmd.ExecuteNonQuery()
        con.Close()

    End Sub

    ' This function deletes one record from the Products table.
    Sub ProductsDeleteItem(ByVal ProductID As Integer)
        Dim con As OleDbConnection
        Dim cmd As OleDbCommand = New OleDbCommand()
        Dim paramProductID As New OleDbParameter()

        con = New OleDbConnection(connectionString)
        cmd.Connection = con

        With paramProductID
            .ParameterName = "inProductID"
            .OleDbType = OleDbType.Integer
            .Size = 4
            .Value = ProductID
        End With
        cmd.Parameters.Add(paramProductID)

        cmd.CommandText = "EXECUTE procProductsDeleteItem"
        con.Open()
        cmd.ExecuteNonQuery()
        con.Close()

    End Sub

End Class
Generated using PrettyCode.Encoder

Related devCity.NET articles:

How would you rate the quality of this article?
1 2 3 4 5
Poor Excellent
Tell us why you rated this way (optional):

Article Rating
The average rating is: No-one else has rated this article yet.

Article rating:3.39682539682542 out of 5
 126 people have rated this page
Article Score118598
Comments    Submit Comment

Comment #1  (Posted by Jamie on 04/19/2002)

Very good article although I have one question - is this possible through VB6 or does it have to be in VB.Net
 
Comment #2  (Posted by David Wasserman on 04/19/2002)

Yes, it does work in VB6, pretty much the same way, only you'd use regular ADO instead of ADO.NET.
 
Comment #3  (Posted by Tony on 04/24/2002)

Hello, I have tried the AOD.Net code and with some mod. in VB6 the ADO equivalent code. I connect to the database fine, but when I try to execute the command I receive the following error (80040e09) Cannot update. Database or object is read-only. I am sure this is just a permissions problem, but I have been unsuccessful in resolving this. Any quick tips?
 
Comment #4  (Posted by David Wasserman on 04/24/2002)

A read-only error message can occur for multiple reasons. If you've opened up the database with a read-only cursor, then you'll get this error when trying to update the database. You'll also get a read-only error when trying to open a database that is read-only by file permissions, or in a directory with read-only access.
 
Comment #5  (Posted by Mario on 05/12/2002)

Good article. Like in SQL server database, can Stored procedures be created in Access database IDE instead of writing code in Visual Basic. Secondly, can we use the created stored procedure in ASP and ASP.NET web pages. If, so please show one code for each update, delete and insert data.
 
Comment #6  (Posted by Mario on 05/12/2002)

Good article. Like in SQL server database, can Stored procedures be created in Access database IDE instead of writing code in Visual Basic. Secondly, can we use the created stored procedure in ASP and ASP.NET web pages. If, so please show one code for each update, delete and insert data.
 
Comment #7  (Posted by David Wasserman on 05/12/2002)

In Response to Mario:

Thanks for the complements, here's the answer to your questions:

Unlike SQL Server, there is no interface for Access Stored Procedures (See part 1 of with MS Access Stored Procedures in VB.NET. Stored Procedures can be accessed in ASP.NET without any code modifications to the sample code in this article. Slight modifications are required for Classic ASP, particularly with respect to ADO.
 
Comment #8  (Posted by Juan on 06/22/2002)

Great articles. Both were enlightening. However, there is missing an important issue: Once I create the stored procedure, how can I bring it back and edit it in order to change it?
 
Comment #9  (Posted by Mohammed Al-Shibli on 07/22/2002)

Hi all of ya

Really nice writen and easy to understand. THANX, keep going But dont forget to Smile :)
 
Comment #10  (Posted by an unknown user on 07/26/2002)


 
Comment #11  (Posted by Joyce Cao on 08/14/2002)

Hi David,

Thank you for the article. I am still using Access 97, and I was wondering if I can call a stored procedure that is written in SQL Server from Access 97.

Thank you in advance for your help.

Joyce
 
Comment #12  (Posted by David Wasserman on 08/14/2002)

The following link to Microsoft's online MSDN fully describes how SQL Server stored procedures can be access via Access 97.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/office97/html/introduction.asp
 
Comment #13  (Posted by Steve Nutt on 09/25/2002)

This article saved the day !

I am working abroad and I left my Beginning ASP.net at home. It's not normally a problem as I work with SQL Server and have a good database class. However, I have to quickly knock together a little app that uses Access and I much prefer to use stored procedures (queries).

I very nearly gave up until I got your article - Thanks a Lot - you saved me a trip into the city to re-purchase a book.

5 out of 5 from me.

Steve.
 
Comment #14  (Posted by Anthony Johnston on 10/02/2002)

Thanks for the article. Can access stored procedures have different access rights assigned than the current user?
 
Comment #15  (Posted by am on 10/29/2002)

through Access' query interface. Otherwise you have to delete (drop) it and create it again with modifications.
 
Comment #16  (Posted by Alan on 12/06/2002)

Very useful.
I am trying to write 2 or more SQL statements in one stored procedure.
But it seems that access can't support that. I will try another way. :)
 
Comment #17  (Posted by John Payne on 01/23/2003)

In response to mario's question: <>. I had no problems.

1. I opened my access db, clicked on the "queries" tab, and created a query in SQL design mode. ALL i did was type in my Query:
SELECT *
FROM SHOPPINGCART
WHERE CartID=@CartID;

2. I saved the query...gave it a name and ran it as i would run any CommandType.StoredProcedure, while passing in my parameter @CartID.

3. I can go into this query anytime through MS Access and edit it. I am using Access 2002.

you can see a code example of how to run a stored query from ASP.NET using VB.NET at: http://www.asp.net/Forums/ShowPost.aspx?tabindex=1&PostID=28762

My next question is....how do i return a value from the stored query? I need to get the count of items in a shopping cart, and prefer to just return the value from the query. Otherwise i have to do something like: SELECT Count(CartID) as ItemCount FROM ShoppingCart WHERE CartID = @CartID

-John-


 
Comment #18  (Posted by JCM van den Broek on 03/03/2003)

Hmmm I can create the stored procedure, but can I delete it??
 
Comment #19  (Posted by M Hanif on 05/07/2003)

Hi,
This is indeed a good article, but can we write more than one queries in a single Stored procedure as we used to do in SQL server.
 
Comment #20  (Posted by RonaldFinkbine on 07/14/2003)

I cannot compile this on my xp box (with access 2000) using vbc

The compile statement
vbc /r:system.data.dll sample.vb

cannot find system.data.oledb

BTW, I jsut installed MDAC 2.7 (again) so why isn't oledb there?

Thanks.





 
Comment #21  (Posted by Des on 07/17/2003)

Excellent article, do you know how to retrieve images from MS Access from ASP.NET?
 
Comment #22  (Posted by Mubi on 08/29/2003)

can we use the declare and if else statements in an ms access stored procedure the way it is used in SQL
 
Comment #23  (Posted by Steve King on 09/19/2003)

When I call my stored procedure (an insert statement) in an Access 2002 MDB the data went into the wrong columns even though I specified the names of the parameters. What's going on?
 
Comment #24  (Posted by sarada on 03/25/2004)

pls reply fast
 
Comment #25  (Posted by steve on 04/24/2004)

excuse me but could someone please tell me what the acronym "AOD"stands for?
 
Comment #26  (Posted by John on 05/07/2004)

hmmm... well the acronym "AOD" means nothing to me... my guess is they meant ADO which stands for Active X Data Objects... there is also DAO which is Data Access Objects.... I know of a band called "AOD" (Ancient of Days) but thats not what you're looking for I'm sure! :)
 
Comment #27  (Posted by José Mª on 07/23/2004)

Hello, First of all, excuse me, because I'm spanish and my english is not good.
I have a problem using the stored procedures. I create the following procedure:

"CREATE PROC CConvocatoriaD_Actualizar(ic LONG," & _
" nom VARCHAR(50), fecha DATE, ca VARCHAR(9)) AS UPDATE Convocatoria SET Nombre =" & _
" nom, CursoAcad = ca, Fecha = fecha WHERE [ID-convocatoria] = ic;"

But, when I execute it, occurs an OleDbException:

In spanish, the message is:

"No se puede actualizar 'Fecha'; el campo no es actualizable."

It means approximately that the field ' Fecha' cannot be updated. It seems that it doesn't allow to update the fields with type "DATE". The OleDbParameter that I use is OleDbType.Date and I assign him a variable of type "DateTime".

If I execute the same sentence in a string SQL and not in a stored procedure, it doesn't happen that exception.
Can you help me?, Thank you.

 
Comment #28  (Posted by Prakash Tirumalaseti on 09/25/2004)

This is very nice article about handling MS Access database stored procedures.
Things are explained very clearly and in easy Way.
 
Comment #29  (Posted by Ismail Shaik on 11/02/2004)

Wow. I didn't realize that Access supports stored procs prior to reading this article. Thanks a lot for sharing the info in such a nice article.

Regards
Ismail
 
Comment #30  (Posted by DZO on 11/28/2004)

It seems that everyone explains how to execute Action stored queries, but i have yet to see an article on the preferred method to execute and return data from a MS Access SELECT stored query.
 
Comment #31  (Posted by VIVEK SINGH on 03/11/2005)
Rating
can we use mdi with datagrid control

 
Comment #32  (Posted by an unknown user on 03/16/2005)
Rating
i don't understand
 
Comment #33  (Posted by Chris on 03/22/2005)
Rating
Great article. Really saved my life when I had a host which would not support SQL and could not get MySQL configured.
 
Comment #34  (Posted by Suryanarayana on 03/24/2005)

How to see stored porocedure from access and how to modify them
 
Comment #35  (Posted by sanny on 03/30/2005)
Rating
I was reading through this article, I have been doing a project with access 2000 as backend and Visual .net. I'm new to visual .net and like to know if I can do the following.
I have created few queries in access. I want to be able to send input to this query in access using the Visual .net form. and display it on the form. Basically the query would have 2 input, location and date, depending on the location and the date they select using the calender on the form, I should display the result the query in access would produce. I'm not sure how to send data to the query, I have tried Ado.net and data grid but using that, I can load from a table and load back changes to a table, but I am trying to find a way to send data to the query on access display it on the visual .net form and move this information to another table back in acess after the user makes modification. I would appreciate if you could let me know how I could do this. Thanks a million
 
Comment #36  (Posted by an unknown user on 03/31/2005)
Rating
Sir
i written a query in MS Access Database
select * fro bill_mst where billno=b
in this query b is parameter ask at the time of execution of this query.is it possible to pass this parameter through VB application if yes how plz give me code.
Rajeev Shukla
shuklarajeev_tcs@rediffmail.com

 
Comment #37  (Posted by an unknown user on 03/31/2005)
Rating
Sir
i written a query in MS Access Database
select * fro bill_mst where billno=b
in this query b is parameter ask at the time of execution of this query.is it possible to pass this parameter through VB application if yes how plz give me code.
Rajeev Shukla
shuklarajeev_tcs@rediffmail.com

 
Comment #38  (Posted by an unknown user on 04/06/2005)
Rating
Excellent and Precisely, what I am looking at. This really saves me hours.
After knowing how to do StoredProc using sqlHelper MS DAAB in SQL Svr, doing it in OraHelper or AdoHelper must follow similarly.
Cheers
 
Comment #39  (Posted by an unknown user on 04/17/2005)
Rating
good article
 
Comment #40  (Posted by an unknown user on 04/20/2005)
Rating
I give a rating of 4, I would have given 5 but in part 1 the Author says don't use @; Then in the sample code there is an @. Picky of me I know! but in this development game one character can cause hours of confusion.
 
Comment #41  (Posted by an unknown user on 04/20/2005)
Rating
In response to comment #40...the author never says not to use @...your criticism is incorrect.
 
Comment #42  (Posted by an unknown user on 04/25/2005)
Rating
this code is nice and also very useful
 
Comment #43  (Posted by an unknown user on 04/25/2005)
Rating
clear
 
Comment #44  (Posted by Adam on 04/26/2005)
Rating
Thanks for the excellent article - overall this has been extroardinarily useful. I did encounter one problem that I was wondering if you've ever seen, and could shed some light on.

When I try to create a stored procedure for MS Access, and I specify some parameters (eg. "CREATE PROC sp_SelectPWDResetQuestion(@ID varchar(32)) AS SELECT ...") - I keep getting a "syntax error". However, if I remove the "@ID varchar(32)" and try to create the stored proc again, everything is fine.

Any thoughts ? Thanks in advance !
~ Adam

 
Comment #45  (Posted by an unknown user on 05/04/2005)
Rating
This is awesome
 
Comment #46  (Posted by Sankar.V on 05/10/2005)
Rating
Very Well David. But i want to see the Procedure in MS Access and i want to modify from Ms Access. Pls Guide me
 
Comment #47  (Posted by Maha on 05/11/2005)
Rating
Everything is simple to understand. Its really great work.
 
Comment #48  (Posted by an unknown user on 06/27/2005)
Rating
Very Good article. I wonder if you could help me. I am having some problems passing parameters to my stored procedure. I have included a code snippet based on your article. Could you help.If I hardcode the parameters in the proc and simplly call the proc from my app, it works, but when I try to pass in a parameter it doesn't.

OdbcConnection con;
OdbcCommand cmd = new OdbcCommand ();
OdbcParameter paramInd = new OdbcParameter();
OdbcParameter paramNewBook = new OdbcParameter();

con = new OdbcConnection (strConnection);
cmd.Connection = con;


paramInd.ParameterName = "@indicator_mapping";
paramInd.OdbcType = OdbcType.Char;
paramInd.Size = 1;
paramInd.Value = "N";

cmd.Parameters.Add(paramInd);

paramNewBook.ParameterName = "@new_book_name";
paramNewBook.OdbcType = OdbcType.Char;
paramNewBook.Size = 4;
paramNewBook.Value = TextBox1.Text;

cmd.Parameters.Add(paramNewBook);

cmd.CommandText = "EXECUTE AddNewScrapBook_Proc";
con.Open();
cmd.ExecuteNonQuery();
con.Close();
 
Comment #49  (Posted by an unknown user on 06/28/2005)
Rating
No output parameters! I need the ID of the record I'm inserting WITHOUT making two trips to the database
 
Comment #50  (Posted by an unknown user on 07/12/2005)
Rating
Hi David, I really find the two articles very helpful and informative. I however get the following error when executing the web page:

"The Microsoft Jet database engine cannot find the input table or query 'procMyDataList'. Make sure it exists and that its name is spelled correctly. "

I built my apps using the same model in your article. For some reasons the SPs are not being written to the Access Database (which causes for the aspx page not to find the particular SP). The folder where the db resides has "Modify" permission and the"Write" box is checked in IIS configuration.

Could you please help? Thanks so much.
 
Comment #51  (Posted by an unknown user on 07/19/2005)
Rating
How do you delete a stored procedure from access? I can't even see it, but it works great!
 
Comment #52  (Posted by Jared on 07/19/2005)
Rating
Oh I got it

sSQL = "DROP PROC procProductsList;"
CreateStoredProc(sSQL)

Now if I could only view a list of procs in my db?!
 
Comment #53  (Posted by an unknown user on 07/20/2005)
Rating
It is very helpful for me...what i am searching for..i found it in this article..
 
Comment #54  (Posted by Tom on 08/09/2005)
Rating
I cannot retreive data to 3 textboxs. all the other examples are OK. What am I missing.
Thanks in advance.
Tom

 
Comment #55  (Posted by Ken on 09/16/2005)
Rating
To get a list of Queries stored in an Access DB use the following Query:

Select Name FROM mSysObjects Where Type=5

Ken -CSMicro Systems

 
Comment #56  (Posted by an unknown user on 10/06/2005)
Rating
perfect with code examples
 
Comment #57  (Posted by an unknown user on 11/08/2005)
Rating
This is a good way to explain stored procedure. but please tell us about the syntax of writing a stored procedure. and another point there are two types of paremeters in stored procedure In and OUT. please demonstrate the use of OUT parameter
 
Comment #58  (Posted by an unknown user on 11/11/2005)
Rating
Here there is no explanation for writing stored procedures in sqlserver enterprize manager
 
Comment #59  (Posted by an unknown user on 11/11/2005)
Rating
On Comment #59, of course there is nothing on SQL Server, do you see the title? It says MS Access. Access is another database product seperate from SQL Server. Although you can use SQL Server with Access, that is not what this article is about. The author did a wonderful job covering a topic that is hard to find information on.
 
Comment #60  (Posted by an unknown user on 12/05/2005)
Rating
thank you David. you help me a lot ..!!!
 
Comment #61  (Posted by an unknown user on 12/13/2005)
Rating
very good but how I can use it in my App.?
 
Comment #62  (Posted by an unknown user on 01/03/2006)
Rating
Good Article.
One question: could it possible to get all the queries of microsoft access through programatically using asp.net and read the code and convert to stored procedures through code only.
 
Comment #63  (Posted by Mahesh Dhinge on 01/03/2006)
Rating
Your comment was: Good Article. One question: could it possible to get all the queries of microsoft access through programatically using asp.net and read the code and convert to stored procedures through code only.
 
Comment #64  (Posted by an unknown user on 03/01/2006)
Rating
This article is a big help with a School application I am building.
 
Comment #65  (Posted by an unknown user on 03/14/2006)
Rating
very nice
 
Comment #66  (Posted by an unknown user on 03/15/2006)
Rating
actually i want to get return value from stored procedure
 
Comment #67  (Posted by an unknown user on 07/17/2006)
Rating
Not very good
 
Comment #68  (Posted by an unknown user on 07/20/2006)
Rating
I did not know you could do this.
 
Comment #69  (Posted by an unknown user on 07/26/2006)
Rating
Because its not clear to what is define in line if u are explain the in every line what advantage about that line what step is used so that is impact ful
 
Comment #70  (Posted by an unknown user on 08/16/2006)
Rating
You 'da Man!
 
Comment #71  (Posted by an unknown user on 09/09/2006)
Rating
This is a unique article not at all discussed elsewhere.
thanks a lot
 
Comment #72  (Posted by an unknown user on 01/17/2007)
Rating
Sir,
I have 1 question.How can we display data to datagrid in ASP.NET from MSAccess..
 
Comment #73  (Posted by an unknown user on 01/31/2007)
Rating
tanx its very helpful to me
 
Comment #74  (Posted by an unknown user on 04/30/2007)
Rating
Merci bien

Thanks, nice article, have you any idea to use theses procedures with the regulars DataAdapter.Update

It seems that there is some issues about that
regards Loïc

 
Comment #75  (Posted by an unknown user on 05/04/2007)
Rating
good article..i want to use the stored procedur in ASP.net how can i use stored procedure..Give some guidence
 
Comment #76  (Posted by an unknown user on 05/23/2007)
Rating
Creating procedure in code, is great!
But, for example when I changed columns of a table, then the procedure w'ont run properly.
So, how can change an procedure in dinamically for Access?
I tried below, but not success. :(
ALTER PROC
DROP PROC
DELETE PROC

Are there any command to success this?
Thanks...
(mbirgin@yahoo.com)
 
Comment #77  (Posted by an unknown user on 06/27/2007)
Rating
Why dont you show how to extract data from the record set?
 
Comment #78  (Posted by vaibhav on 08/08/2007)
Rating
hi sir
i want to knw thw syntax of update command to update my data whish is stored in database(ms-access) while working with asp.net......if u can post the corrrect syntax 2 my email id, i'll b thankfull 2 u
waiting 4 ur reply...
 
Comment #79  (Posted by an unknown user on 08/15/2007)
Rating
It helped alot. I was struggling with Access database to create the procedures.

Braj
India
 
Comment #80  (Posted by an unknown user on 08/17/2007)
Rating
great!
 
Comment #81  (Posted by an unknown user on 08/22/2007)
Rating
very poor code is not meant for novice
 
Comment #82  (Posted by an unknown user on 08/22/2007)
Rating
Because I don't this concept is stored procedure in MS-Access
 
Comment #83  (Posted by Bob on 09/26/2007)
Rating
Overall I thought the article was excellent; however, no examples were provided showing how to obtain a dataset result when you pass a parameter to a query.

My understanding is you must use the ExecuteNonQuery to pass the parameters, but that doesn't return a resulting dataset.

How would I code a simple query to return all rows into a dataset where the selected rows are in a given city passed as a parameter?
 
Comment #84  (Posted by an unknown user on 11/12/2007)
Rating
Its is good,but when does it execute as u haven't written it in any button_click, so could i run and give values
 
Comment #85  (Posted by Para,m on 01/11/2008)
Rating
Can we use ms access module as stored procedure?
 
Comment #86  (Posted by an unknown user on 02/27/2008)
Rating
Thank you very much.
 
Comment #87  (Posted by an unknown user on 02/28/2008)
Rating
no visual sample
 
Comment #88  (Posted by an unknown user on 03/09/2008)
Rating
Good ................
 
Comment #89  (Posted by an unknown user on 05/06/2008)
Rating
code works
 
Comment #90  (Posted by an unknown user on 08/31/2008)
Rating
Excelente!! Aplicas todos los Stores Procedures de un ABC y/0 mtto de una tabla.
 
Comment #91  (Posted by an unknown user on 09/19/2008)
Rating
Except for the bit about not using @ with parameters (which I find works absolutely splendidly with MS Access) the articles led me by the hand through the subject area, for which I thank you. Excellent articles.
 
Comment #92  (Posted by an unknown user on 11/15/2008)
Rating
Thought the explaination and concrete program was very useful. As an intermediate user this is the type of information I relate to and can extract 1. Overview of the whole process 2. The complete concrete example can be broken down to the areas I have problems with. Other people may be having problems with other aspects
 
Comment #93  (Posted by an unknown user on 12/16/2008)
Rating
Hi. Nice article. I followed both part 1 and 2 dotting all my I's and crossing all my T's but when I try to run my code, I get "Expected query name after EXECUTE." What gives?
 
Comment #94  (Posted by Madhuri Nimse on 04/03/2009)
Rating
Hi,
I got the following error :
"Expected query name after EXECUTE"
My code as follows.....
-----------------------------------------
string GetUserDetails =
"CREATE Proc GetUserDetails(USER_NAME VARCHAR(40)) " +
" AS " +
" Select UserID, Firstname,Lastname, Username, [password], RoleID, Role " +
" From UserList where UserName=USER_NAME;";
------------------------------------------

OleDbDataReader dr ;//= new OleDbDataReader();
OleDbConnection conn = new OleDbConnection(GeneralConstant._connectionString);
OleDbCommand cmd = new OleDbCommand();
OleDbParameter prm = new OleDbParameter();
try
{
conn.Open();
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "EXECUTE GetUserDetails";
cmd.Connection = conn;
prm.ParameterName = "USER_NAME";
prm.OleDbType = OleDbType.VarChar;
prm.Size = 40;
prm.Value = USER_NAME;
cmd.Parameters.Add(prm);

dr = cmd.ExecuteReader();//CommandBehavior.CloseConnection);
conn.Close();
return dr;
}
-------------------------------------
Giving me error.

Please Suggest me ! :)
Rgds



 
Comment #95  (Posted by an unknown user on 08/17/2009)
Rating
Very useful article. Big phanx.
 
Comment #96  (Posted by on 10/11/2009)
Rating

 
Comment #97  (Posted by When taken in recreational doses, on 11/09/2009)
Rating
plavix experiences plavix experiences plavix experiences . plavix experiences plavix experiences . plavix experiences plavix experiences . plavix experiences carisoprodol pills uk carisoprodol pills uk . carisoprodol pills uk carisoprodol pills uk . carisoprodol pills uk carisoprodol pills uk . carisoprodol pills uk carisoprodol pills uk carisoprodol pills uk . female sexual inhancer ambien spray female sexual inhancer ambien spray female sexual inhancer ambien spray female sexual inhancer ambien spray female sexual inhancer ambien spray . female sexual inhancer ambien spray female sexual inhancer ambien spray female sexual inhancer ambien spray female sexual inhancer ambien spray female sexual inhancer ambien spray .
 
Comment #98  (Posted by Only Medicine in Australia, on 11/24/2009)
Rating
Keep up this great resource: URLsWithHREF
 
Comment #99  (Posted by DorMastevr on 11/27/2009)
Rating
Very realistic and amusing site.: URLsWithNothing
 
Comment #100  (Posted by an unknown user on 12/03/2009)
Rating
Thanks, great article. But I have one question: it is possible to create a function? And if yes, it is possible to call the funtion from the stored? Thanks.
 
Comment #101  (Posted by an unknown user on 12/03/2009)
Rating
Thanks, great article. But I have one question: it is possible to create a function? And if yes, it is possible to call the funtion from the stored? Thanks.
 
Comment #102  (Posted by Sara on 12/03/2009)
Rating
Thanks, very good article. But I have two questions: it is possible to create a function? And if yes, it is possible to call the funtion from the stored? Thanks.
 
Comment #103  (Posted by an unknown user on 12/03/2009)
Rating
JEHOVAH father Please save father!
 
Sponsored Links