Hi all,
Can anybody help me...How to create insert store procedure in access db with c# windows application.

Here is a technique for creating a stored procedure in an Access database using C# code.

//using System.Data.Odbc;
      private static bool CreateProc(ref string strError)
         bool blnRetVal = true;

         string strSQL =
            "create proc InsTestNum2(inTestNum) AS INSERT INTO Test_Detail(test_no) values(inTestNum)";

            using (OdbcConnection conn = new OdbcConnection("DSN=DW_ACCESS"))
               (new OdbcCommand(strSQL, conn)).ExecuteNonQuery();
         catch (Exception exc)
            blnRetVal = false;
            strError = exc.Message;

         return blnRetVal;

This requires the DSN to be registered in the OdbcAdministrator
Control Panel / Administrative Tools / Data Sources (ODBC)

Also, it will need to be customized for your particular database.

This can be called from any type of app with something like this:

//using System.Diagnostics;
         string strError = "";

         if (!CreateProc(ref strError))
            Trace.WriteLine("Could not create proc: " + strError);

Edited 5 Years Ago by thines01: formatting

This question has already been answered. Start a new discussion instead.