두 변수를 삽입하는 방법을 알려주십시오.mysql에 삽입 할 때 C# 코드에 문제가 발생했습니다.
string insert [email protected]"Insert into userHistory(userid,mobile) values(x,y)";
같은 코드에서 직접 내 사용자 ID 및 모바일을주는 그 문제가되지 않습니다이 내 코드이지만, 삽입 실패 (편집자 주 : 영업 이익은 오류 제공하지) 않고
int userid = 123456;
long mobile = 91888888888;
sqlConn = new MySqlConnection(/* conn string removed */);
sqlConn.Open();
string insert =
@"Insert into userHistory(userid,mobile) values(@userid,@mobile);";
MySqlCommand cmd = new MySqlCommand(insert,sqlConn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add(new MySqlParameter("@userid", userid));
cmd.Parameters.Add(new MySqlParameter("@mobile", mobile));
"나는 할 수 없습니다."실제로 문제를 설명하지 않습니다. http://tinyurl.com/so-hints –
무엇이 오류입니까?를 참조하십시오. –
안녕하세요 @Pranay Rana, 제 생각에 당신의'? '-key가 붙어 있습니다 ;-) –