Click here to Skip to main content
15,889,808 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
string[] split = Arr[i].Split('|');
string sqlCmd = "INSERT INTO table1 (ID, Region, Name) " +
"VALUES (" + split[0] + ',' + split[1] + ',' + split[2] + ")";

and I get an OleDbException: missing parameter.

Arr[] contains strings like this:
0001|sddfg|dfg dfgh

Please, help.
Posted

1 solution

Why are you inserting the ID manually? Its better practise to have it auto-increment.

You are also missing ' marks around the (I assume varchar) values you are inserting.

I would try something like this:



split = Arr[i].Split('|');
string sqlCmd = "INSERT INTO table1 (Region, Name) " +
"VALUES ('" + split[1] + "','" + split[2] + "')";

 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900