c# - Use OleDbDataAdapter to insert into an Access db -


मैं कुछ डाटा को एक्सेस डाटाबेस में डालना चाहूंगा।

  DataTable dt = new विवरण सारणी(); स्ट्रिंग sql = string.Format ("SELECT * FROM {0} जहां 1 = 0;", tmap.SqlTableName); स्ट्रिंग con = string.Format (conn, accesspath); OleDbDataAdapter da = नया OleDbDataAdapter (sql, con); OleDbCommandBuilder cmdBuilder = नया OleDbCommandBuilder (da); Da.InsertCommand = cmdbuilder.GetInsertCommand (सच); // रिटर्न "INSERT परीक्षा (int, bdate, amt, text, bit) VALUES (?,?,?,?,?)" Da.Fill (dt); // DateTable के लिए डेटा जोड़ें (int i = 0; i & lt; rowCount; i ++) {DataRow dr = dt.NewRow (); // .... dt.Rows.Add (dr); } Da.Update (dt); // यह वह जगह है जहां चीजें दक्षिण चलती है  

System.Data.OleDb.OleDbException
संदेश: निषेध बयान में सिंटैक्स त्रुटि। स्रोत: माइक्रोसॉफ्ट जेट डाटाबेस इंजिन।

अगर मैं बदल जाता हूं Insert command:

  da.InsertCommand = new OleDbCommand ("INSERT परीक्षण ([पाठ]) मूल्यों (?)");  

और इनकमिंग डेटा को केवल एक टेक्स्ट वैल्यू में बदलने के लिए जो मुझे मिलता है:

एक या अधिक आवश्यक पैरामीटरों के लिए कोई मान नहीं दिया गया है।

क्या मैं कुछ भूल रहा हूं?

समस्या डेटा प्रकारों में थी प्रश्न का कोड काम करता है यदि डेटा प्रकार संगत हैं।


Comments

Popular posts from this blog

Is there an open source WebSockets (JavaScript) XMPP library? -

java - Is there an object like a "Set" that can contain only unique string values, but also contain a count on the number of occurrences of the string value? -

mysql - Can mysql_pconnect be called multiple times in one php page? -