Hi,
I created a web form including insert button..After I enter some values into the fields, I want them to be inserted into Oracle database..Is my script right??Or if I'm wrong in somewhere in my script, please inform me about it.. I got lots of errors :((
private void OnButton_Click(object sender, System.EventArgs e)
{
OracleConnection myConnection = new OracleConnection(myRegistry.getRegistryValue("connectionString"));
myConnection.Open ();
String insertCmd = "nsert into PATIENTS (PATIENT_NUMBER, PATIENT_NAME, PATIENT_LASTNAME)" +
" values(;patient_number ;patient_name ;patient_lastname;"), myConnection)";
OracleCommand myCommand = new OracleCommand(insertCmd, myConnection);
myCommand.Parameters.Add("patient_number", OracleType.Number, 5, "PATIENT_NUMBER");
myCommand.Parameters.Add("patient_name", OracleType.VarChar, 20,"PATIENT_NAME");
myCommand.Parameters.Add("patient_lastname", OracleType.VarChar, 20,"PATIENT_LASTNAME");
myCommand.ExecuteNonQuery();
BindGrid(myConnection);
myConnection.Close ();
}
public void BindGrid()
{
OracleDataAdapter myCommand = new OracleDataAdapter("SELECT * FROM PATIENTS", myConnection);
DataSet myDataSet = new DataSet();
myCommand.Fill(myDataSet);
dataGrid1.DataSource=myDataSet;
dataGrid1.DataBind();
}
Answers (2)
0
It seems like you're seeking guidance on the usage of the HttpContext.Current.Session in ASP.NET within the scope of career advice technology. Let's delve into this technical query.
The provided code snippet aims to retrieve the value stored in the session variable "cUserType" within the ASP.NET framework. This implies that the cUserType session variable is being accessed and its value is being converted to a string using the ToString() method.
In the context of career advice technology, it's important to ensure secure and efficient usage of session variables. This includes considering data persistence, session management, and potential security vulnerabilities.
If you have specific questions or concerns about using session variables in ASP.NET for career advice technology, feel free to elaborate, and I'd be glad to provide further insights or code examples.