Click here to Skip to main content
15,914,010 members
Home / Discussions / C#
   

C#

 
GeneralRe: encryption Pin
surfman1917-Sep-05 8:20
surfman1917-Sep-05 8:20 
GeneralRe: encryption Pin
Niklas Ulvinge17-Sep-05 9:23
Niklas Ulvinge17-Sep-05 9:23 
GeneralRe: encryption Pin
surfman1918-Sep-05 2:17
surfman1918-Sep-05 2:17 
GeneralRe: encryption Pin
Niklas Ulvinge18-Sep-05 5:11
Niklas Ulvinge18-Sep-05 5:11 
GeneralRe: encryption Pin
Dan Neely19-Sep-05 2:02
Dan Neely19-Sep-05 2:02 
QuestionMoving Control on MouseMove Event Pin
Seraphin17-Sep-05 5:13
Seraphin17-Sep-05 5:13 
AnswerRe: Moving Control on MouseMove Event Pin
thrakazog17-Sep-05 10:41
thrakazog17-Sep-05 10:41 
QuestionCan't insert date using ODBC/DSN connection to MS-access db Pin
Cuth17-Sep-05 4:43
Cuth17-Sep-05 4:43 
Hi I am struggling to insert a record into an existing database with 2 Text fields. I

am using ODBC/DSN to connect to the database. The MS-Access database is

in my secure DB folder. I am able to read the database content and display.

However, I can't insert any records. I am sure the datatypes are compatible

with the database and the # of fields are correct.

Error:
-------
ERROR [07002] [Microsoft][ODBC Microsoft Access Driver] Too few

parameters. Expected 2.

Do you think this has something to do with permissions and I have to ask my

hosting company if they can give me write permissions?

Appreciate if anyone can help.


Complete code:
------------------------

OdbcConnection dbConnection = new OdbcConnection(strODBC);

String sqlStmt = "INSERT INTO outbox(db_email1, db_email2) VALUES

(@email1, @email2)";



OdbcCommand dbCommand = new OdbcCommand(sqlStmt,

dbConnection);

OdbcParameter e1Param = new OdbcParameter("@email1",

OdbcType.VarChar, 255, "db_email1");
e1Param.Value = email1;
dbCommand.Parameters.Add(e1Param);



OdbcParameter e2Param = new OdbcParameter("@email2",

OdbcType.VarChar, 255, "db_email2");
e2Param.Value = email2;
dbCommand.Parameters.Add(e2Param);




dbConnection.Open();
try
{

dbCommand.ExecuteNonQuery();
}
catch (OdbcException xx)
{
// Exception
errorMsg.Text = "Insert Data Failed - " + xx.Message;
}
dbConnection.Close();

AnswerRe: Can't insert date using ODBC/DSN connection to MS-access db Pin
Dave Kreskowiak17-Sep-05 14:26
mveDave Kreskowiak17-Sep-05 14:26 
QuestionhowtoL Loading Excel Add-ins with OWC spreadsheet control? Pin
Shmulik2817-Sep-05 2:06
Shmulik2817-Sep-05 2:06 
QuestionRead non standard conformant XML Pin
tommazzo17-Sep-05 2:01
tommazzo17-Sep-05 2:01 
AnswerRe: Read non standard conformant XML Pin
Guffa17-Sep-05 2:23
Guffa17-Sep-05 2:23 
GeneralRe: Read non standard conformant XML Pin
tommazzo17-Sep-05 2:30
tommazzo17-Sep-05 2:30 
QuestionRe: Read non standard conformant XML Pin
tommazzo17-Sep-05 11:01
tommazzo17-Sep-05 11:01 
Questionhow to access client side (javascript value) from c# (server side) Pin
mohd rafi17-Sep-05 0:29
mohd rafi17-Sep-05 0:29 
AnswerRe: how to access client side (javascript value) from c# (server side) Pin
Guffa17-Sep-05 0:41
Guffa17-Sep-05 0:41 
Questiondatagrid Pin
bsylviain17-Sep-05 0:02
bsylviain17-Sep-05 0:02 
QuestionMdi child problem Pin
prakash_B0216-Sep-05 23:20
prakash_B0216-Sep-05 23:20 
QuestionHelp with drawing a 2D beveled Pie Chart Pin
Raul00716-Sep-05 18:35
Raul00716-Sep-05 18:35 
AnswerRe: Help with drawing a 2D beveled Pie Chart Pin
mav.northwind16-Sep-05 21:43
mav.northwind16-Sep-05 21:43 
GeneralRe: Help with drawing a 2D beveled Pie Chart Pin
Raul00718-Sep-05 19:21
Raul00718-Sep-05 19:21 
GeneralRe: Help with drawing a 2D beveled Pie Chart Pin
mav.northwind19-Sep-05 3:49
mav.northwind19-Sep-05 3:49 
GeneralRe: Help with drawing a 2D beveled Pie Chart Pin
Raul00719-Sep-05 6:36
Raul00719-Sep-05 6:36 
QuestionWindows Mobile 5 Details and .NET Compact 2.0 Pin
bragac20016-Sep-05 10:55
bragac20016-Sep-05 10:55 
AnswerRe: Windows Mobile 5 Details and .NET Compact 2.0 Pin
thrakazog18-Sep-05 5:17
thrakazog18-Sep-05 5:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.