Oracle 9i reported ORA-01036: Invalid variable name/Number
The
The problem is the variable name.
SQL method: @ username
I use the Oracle database in the following way: username
Just change to Oracle.
Public StringInsertUser (UsersUser)
{
// String SQL = "insert into Tuser (user_id, username, password, gender, email, mphone)" +
//"Values (FN_SYS_GETGUID (), @ username, @ password, @ gender, @ email, @ mphone )";
OracleConnectionOracleConnection =DBHelper. GetOracleConnection;
StringRowId =String. Empty;
Try
{
OracleConnection. Open ();
// OracleCommand cmd = new OracleCommand (SQL, oracleConnection );
OracleCommandCmd = oracleConnection. CreateCommand ();
Cmd. CommandText ="Insert into Tuser (user_id, username, password, gender, email, mphone )"+
"Values (FN_SYS_GETGUID (),: username,: password,: gender,: email,: mphone )";
Cmd. Parameters. AddWithValue ("Username", User. UserName );
Cmd. Parameters. AddWithValue ("Password", User. PassWord );
Cmd. Parameters. AddWithValue ("Gender", User. Gender );
Cmd. Parameters. AddWithValue ("Email", User. Email );
Cmd. Parameters. AddWithValue ("Mphone", User. Mphone );
OracleStringOracleRowId;
Cmd. executeappslenonquery (OutOracleRowId );
RowId = repeated lerowid. Value;
}
Catch(OracleException)
{}
Finally
{
OracleConnection. Close ();
}
ReturnRowId;
}