hitai
October 29th, 2005, 04:44 AM
In the web application I`m trying to build, there is a form with text boxes on it as a submit button. When the submit button is clicked, the following even handler will execute
private void butangSerah_Click(object sender, System.EventArgs e)
{
this.oleDbConnection.Open ( ) ;
this.oleDbDataAdapter.InsertCommand.CommandText = "INSERT INTO Customers " +
"( IC_no, Username, PasswordText, Name, Gender, Address, telefon, Email, " +
"Occupation ) VALUES ( " + this.nomborKP.Text + "," + this.namaPengguna.Text +
"," + this.kataLaluan.Text + "," + this.nama.Text + "," +
( this.jantina.SelectedValue == "Male" ? true : false ) +
"," + this.alamat.Text + ","
+ this.emel.Text + "," + this.pekerjaan.Text + ")";
this.oleDbDataAdapter.InsertCommand.ExecuteNonQuery ( ) ;
this.oleDbConnection.Close ( ) ;
}
The problem that I`m having is that the line "this.oleDbConnection.Open ( ) ;" throws an OleDbException with the message "The Microsoft Jet database engine cannot open the file 'C:\Inetpub\wwwroot\kedaiCPOnline\bin\onlineCDShop.mdb'. It is already opened exclusively by another user, or you need permission to view its data. "
I`ve tried checking the code and everything and i can`t figure out the problem. Anyone can help? And BTW, nothing else has an open connection to the database. At least none that I know of.
private void butangSerah_Click(object sender, System.EventArgs e)
{
this.oleDbConnection.Open ( ) ;
this.oleDbDataAdapter.InsertCommand.CommandText = "INSERT INTO Customers " +
"( IC_no, Username, PasswordText, Name, Gender, Address, telefon, Email, " +
"Occupation ) VALUES ( " + this.nomborKP.Text + "," + this.namaPengguna.Text +
"," + this.kataLaluan.Text + "," + this.nama.Text + "," +
( this.jantina.SelectedValue == "Male" ? true : false ) +
"," + this.alamat.Text + ","
+ this.emel.Text + "," + this.pekerjaan.Text + ")";
this.oleDbDataAdapter.InsertCommand.ExecuteNonQuery ( ) ;
this.oleDbConnection.Close ( ) ;
}
The problem that I`m having is that the line "this.oleDbConnection.Open ( ) ;" throws an OleDbException with the message "The Microsoft Jet database engine cannot open the file 'C:\Inetpub\wwwroot\kedaiCPOnline\bin\onlineCDShop.mdb'. It is already opened exclusively by another user, or you need permission to view its data. "
I`ve tried checking the code and everything and i can`t figure out the problem. Anyone can help? And BTW, nothing else has an open connection to the database. At least none that I know of.