0

I am working on a VB application which will insert data to 5 - 7 tables,out of which two tables have primary key constraints , while inserting data through my application , insert got failed on those two tables that has primary key , when i am trying to insert the same query using the query analyzer it is getting successfully inserted into those two tables , the username and password used through application and the query analyzer are same ,and i am using oledb connection string, rdo for executing the queries in the application.The error which i am getting when the query got failed is very generic and shows

      "Reason -40002-01000: [Microsoft][ODBC SQL Server Driver][SQL Server]The statement has been terminated."

I got puzzled why i am not able to insert the data through my application.Whether i am missing something or need to have some permissions to access the tables

karthik
  • 4,485
  • 8
  • 30
  • 45
  • 1
    Try running SQL profiler when you are trying to insert record using your application and see what query you are getting. May be something is wrong with the query being generated. Get that exact query and run it in analyzer. – bhupendra patel Jul 05 '12 at 07:18
  • 1
    My guess is that there might be single quotes problem. Print the insert statement generated and analyse it – Madhivanan Jul 05 '12 at 08:11
  • I tried the above said methods , copying the query from the SQL Profiler , printed the exact query in the log file and executed the both with success – karthik Jul 05 '12 at 10:01
  • Can you post the query that you are executing and the code used to generate that query – Matt Wilko Jul 06 '12 at 12:25
  • Thanks all,the query is ok but the regional settings caused the error , once i changed it , the query worked .Once again thanks everyone – karthik Jul 09 '12 at 06:02

0 Answers0