????С???????????C#??????Oracle??????????????????? ?ο???MSDN??????????????????????????????SQL??????????????????
?????????????????
//????????ж??????????????????л??????????????????????????????????????????????????
private void buttonCheck_Click(object sender?? EventArgs e)
{
OracleConnection connection = new OracleConnection();
connection.ConnectionString = "Data Source = ORCL;User ID=xiyoulele;Password=xiyoulele;Unicode=false;" + "Persist Security Info=False";
connection.Open();
OracleCommand myCommand = connection.CreateCommand();
myCommand.CommandText = "select * from users";
OracleDataReader datareader = myCommand.ExecuteReader();
datareader.Read();
OracleString oraclestringFirst = datareader.GetOracleString(0);
string firstStr = oraclestringFirst.ToString();
OracleString oraclestringSecond = datareader.GetOracleString(1);
string secondStr = oraclestringSecond.ToString();
if (firstStr == "admin" && secondStr == "888888")
{
MessageBox.Show("????????");
}
else
{
MessageBox.Show("??????");
}
}
//????????в????μ???
private void buttonRegister_Click(object sender?? EventArgs e)
{
OracleConnection orclConn = new OracleConnection();
orclConn.ConnectionString = "Data Source = ORCL; User ID = xiyoulele; Password = xiyoulele; Unicode = false;" + "Persist Security Info = False";
orclConn.Open();
OracleCommand orclCmd = orclConn.CreateCommand();
orclCmd.CommandText = "insert into users values('xiyoulele'??'55555555')";
orclCmd.ExecuteNonQuery();
orclConn.Close();
MessageBox.Show("???????");
}
???????????δ??????????Demo???е?????????????д??????ó??????????