oracle与sqlserver参数区别

1.Oracle

OracleCommand com = new OracleCommand(@"select * from ibs_user where username=:uname and userpwd=:upwd", conn);
com.Parameters.Add(":uname", OracleType.VarChar).Value = userName.Text.Trim();
com.Parameters.Add(
":upwd", OracleType.VarChar).Value = userPwd.Text.Trim();
           
int count = 0;

conn.Open();
count = Convert.ToInt32(com.ExecuteScalar());

2.Sqlserver

SqlCommand com = new SqlCommand(@"select * from ibs_user where username=@uname and userpwd=@upwd", conn);
com.Parameters.Add("@uname", SqlType.VarChar).Value = userName.Text.Trim();
com.Parameters.Add(
"@upwd", SqlType.VarChar).Value = userPwd.Text.Trim();
           
int count = 0;

conn.Open();
count = Convert.ToInt32(com.ExecuteScalar());

你可能感兴趣的:(sqlserver)