Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8613933
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T04:59:54+00:00 2026-06-12T04:59:54+00:00

When I insert through the OleDbCommand with direct values no problem, it’s working fine

  • 0

When I insert through the OleDbCommand with direct values no problem, it’s working fine

OleDbCommand OleCmd1 = new OleDbCommand("Insert into My_Diary (sl_no,reminder) values("+a1+",'CHECK VALUE')", OleCon1);
OleCmd1->ExecuteNonQuery();

But when I like to update through parameter its showing “Syntax Error”….I can’t identify my mistake…

string MyConStr = "Provider=VFPOLEDB.1; Data Source='C:\\For_Dbf'; Persist Security Info=False";    
InsSavDiaryCmd = "Insert into My_Table1 (sl_no,reminder) values (@sl_no,@reminder) ";

VFPDAp=gcnew OleDbDataAdapter();
VFPDApMy_Table1InsertCommand = gcnew OleDbCommand(InsSavDiaryCmd, OleCon1);

WithInsVar = VFPDAp.InsertCommand.Parameters;
WithInsVar.Add("@sl_no", OleDbType.Integer, 10, "sl_no");
WithInsVar.Add("@reminder", OleDbType.Char, 250, "reminder");

OleCon1.ConnectionString = MyConStr;
OleCon1.Open();

OleDbTransaction Trans=OleCon1.BeginTransaction();

//VFPDAp.DeleteCommand.Transaction = Trans;
//VFPDAp.UpdateCommand.Transaction = Trans;
VFPDAp.InsertCommand.Transaction = Trans;

VFPDAp.Update(MyDataTbl);
Trans.Commit();
OleCon1.Close();
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T04:59:55+00:00Added an answer on June 12, 2026 at 4:59 am

    The OleDbCommand doesn’t use named parameters. You need to change the insert statement so that it uses questions.

    InsSavDiaryCmd = "Insert into My_Table1 (sl_no,reminder) values (?, ?) ";
    

    You need to make sure that you have a parameter for each question mark and make sure that the parameters are inserted in order of their use in the insert statement.

    ** If you’d like to use name parameters… you can try using VfpClient which is a project that I’m working on to make data access a little nicer from .Net.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My insert and update pages (through my admin forlder) into mysql stopped working. When
i am using OleDbCommand.ExecuteNonQuery() to insert data into the database: ObjCommand = New OleDbCommand
I have a strange problem, I'm sending an SQL query through PHP: INSERT INTO
INSERT INTO [Temp].[dbo].[Student] ([Fname], [Lname], [Gender]) VALUES (N'Aname', N'Alname', N'Male') GO This codes workes
INSERT INTO `ree`.`media` (`CREATEDATE`, `FILETYPE`, `MIMETYPE`, `MLSNUMBER`, `MODIFYDATE`, `POSITION`, `URL`) VALUES ('2011-12-27T15:00:16', 'PRIMARY PHOTO',
I have a problem when trying to insert certain characters through query with parameters.
I'm trying to insert a System.DateTime into an Access database using a parameterized OleDbCommand
Can i insert a jTable vector data into MSSQL through JDBC in some easy
If you try to insert a new record through phpMyAdmin interface to a table
INSERT INTO tblExcel (ename, position, phone, email) VALUES ('Burton, Andrew', 'Web Developer / Network

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.