oracle: |
OracleConnection Ocon = new OracleConnection("user id=cmes;data source=mes;password=cmes");
OracleCommand Ocom = new OracleCommand("insert into c_emp_t (emp_id,emp_no,emp_name,emp_password,emp_desc,used_date,change_date,logout_date,logout_flag)values(:emp_id,:emp_no,:emp_name,:emp_password,:emp_desc,sysdate,sysdate,null,'0')",Ocon); Ocom.Parameters.Add(new OracleParameter("emp_id","Number")); Ocom.Parameters.Add(new OracleParameter("emp_no","VarChar")); Ocom.Parameters.Add(new OracleParameter("emp_name","VarChar")); Ocom.Parameters.Add(new OracleParameter("emp_password","VarChar")); Ocom.Parameters.Add(new OracleParameter("emp_desc","VarChar")); Ocom.Parameters["emp_id"].Value = int.Parse(TextBox1.Text); Ocom.Parameters["emp_no"].Value = TextBox1.Text; Ocom.Parameters["emp_name"].Value = TextBox1.Text; Ocom.Parameters["emp_password"].Value = TextBox1.Text; Ocom.Parameters["emp_desc"].Value = TextBox1.Text; Ocon.Open(); Ocom.ExecuteNonQuery(); Ocon.Close(); |
sql server |
SqlConnection Mcon = new SqlConnection("workstation id=LIWULI;packet size=4096;user id=sa;password=sa;data source=\"192.168.200.156\";persist security info=False;initial catalog=mcms");
SqlCommand Mcom = new SqlCommand("Insert into userinfo (userid,username,password) values(@userid,@username,@password)",Mcon); Mcom.Parameters.Add(new SqlParameter("@userid","interger")); Mcom.Parameters.Add(new SqlParameter("@username","VarChar")); Mcom.Parameters.Add(new SqlParameter("@password","VarChar")); Mcom.Parameters["@userid"].Value = int.Parse(TextBox1.Text); Mcom.Parameters["@username"].Value = TextBox1.Text; Mcom.Parameters["@password"].Value = TextBox1.Text; Mcon.Open(); Mcom.ExecuteNonQuery(); Mcon.Close(); |