| | |
help connecting a form to a database.. error message
Please support our ASP.NET advertiser: $4.95 a Month - ASP.NET Web Hosting – Click Here!
![]() |
•
•
Join Date: Apr 2005
Posts: 1
Reputation:
Solved Threads: 0
sending form data to database creates a error!
hi i have created a form which should connect to a database and update it when the user inputs into the form, however as soon as i hit the button on the form i get the error No value given for one or more required parameters., I have checked the table names are all correct and cant figure out why it does this can anyone help??
void Page_Load()
{
if(IsPostBack)
{
//Build connection object //
OleDbConnection conn = new OleDbConnection() ;
string connStr;
connStr = "Provider=Microsoft.Jet.OLEDB.4.0;";
connStr += "Data Source= " + Server.MapPath("test.mdb");
conn.ConnectionString = connStr;
// Build command object //
string queryString;
queryString = "Insert INTO Customer(C_FirstName, C_LastName) VALUES(";
queryString += fn.Text + "," + "'" + sn.Text + "')";
OleDbCommand dbCommand = new OleDbCommand();
dbCommand.CommandText = queryString;
dbCommand.Connection = conn;
// Open the connection //
conn.Open();
// insert new record using method executeNonQry
dbCommand.ExecuteNonQuery();
} // end of if
} // end of page_load
the error i recieve is as follows:
No value given for one or more required parameters.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.OleDb.OleDbException: No value given for one or more required parameters.
Source Error:
Line 32:
Line 33: // insert new record using method executeNonQry
Line 34: dbCommand.ExecuteNonQuery();
Line 35:
Line 36:
hi i have created a form which should connect to a database and update it when the user inputs into the form, however as soon as i hit the button on the form i get the error No value given for one or more required parameters., I have checked the table names are all correct and cant figure out why it does this can anyone help??
void Page_Load()
{
if(IsPostBack)
{
//Build connection object //
OleDbConnection conn = new OleDbConnection() ;
string connStr;
connStr = "Provider=Microsoft.Jet.OLEDB.4.0;";
connStr += "Data Source= " + Server.MapPath("test.mdb");
conn.ConnectionString = connStr;
// Build command object //
string queryString;
queryString = "Insert INTO Customer(C_FirstName, C_LastName) VALUES(";
queryString += fn.Text + "," + "'" + sn.Text + "')";
OleDbCommand dbCommand = new OleDbCommand();
dbCommand.CommandText = queryString;
dbCommand.Connection = conn;
// Open the connection //
conn.Open();
// insert new record using method executeNonQry
dbCommand.ExecuteNonQuery();
} // end of if
} // end of page_load
the error i recieve is as follows:
No value given for one or more required parameters.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.OleDb.OleDbException: No value given for one or more required parameters.
Source Error:
Line 32:
Line 33: // insert new record using method executeNonQry
Line 34: dbCommand.ExecuteNonQuery();
Line 35:
Line 36:
Hmmm, well I used your code and it worked for me?
Have you put break points in and seen what values are being passed?
Have you put break points in and seen what values are being passed?
•
•
•
•
Originally Posted by needhelp2005
sending form data to database creates a error!
hi i have created a form which should connect to a database and update it when the user inputs into the form, however as soon as i hit the button on the form i get the error No value given for one or more required parameters., I have checked the table names are all correct and cant figure out why it does this can anyone help??
void Page_Load()
{
if(IsPostBack)
{
//Build connection object //
OleDbConnection conn = new OleDbConnection() ;
string connStr;
connStr = "Provider=Microsoft.Jet.OLEDB.4.0;";
connStr += "Data Source= " + Server.MapPath("test.mdb");
conn.ConnectionString = connStr;
// Build command object //
string queryString;
queryString = "Insert INTO Customer(C_FirstName, C_LastName) VALUES(";
queryString += fn.Text + "," + "'" + sn.Text + "')";
OleDbCommand dbCommand = new OleDbCommand();
dbCommand.CommandText = queryString;
dbCommand.Connection = conn;
// Open the connection //
conn.Open();
// insert new record using method executeNonQry
dbCommand.ExecuteNonQuery();
} // end of if
} // end of page_load
the error i recieve is as follows:
No value given for one or more required parameters.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.OleDb.OleDbException: No value given for one or more required parameters.
Source Error:
Line 32:
Line 33: // insert new record using method executeNonQry
Line 34: dbCommand.ExecuteNonQuery();
Line 35:
Line 36:
![]() |
Similar Threads
- Please help(Problem in insertion data to database) (JSP)
- Error message while importing data to Excel from the MySQL db (MySQL)
- Visual Basic Error message! (Visual Basic 4 / 5 / 6)
- Server Error message when opening asp.net applicationm (ASP.NET)
- Doesn't check if username or email exits in database properly (ASP.NET)
- error message when connecting to internet (Windows NT / 2000 / XP)
Other Threads in the ASP.NET Forum
- Previous Thread: Server Error message when opening asp.net applicationm
- Next Thread: requiredfieldvalidator problem
| Thread Tools | Search this Thread |
.net 2.0 3.5 activexcontrol advice ajax alltypeofvideos asp asp.net bc30451 beginner bottomasp.net browser businesslogiclayer c# cac checkbox class commonfunctions compatible content contenttype countryselector courier css dataaccesslayer database datagrid datagridview datagridviewcheckbox datalist deployment development dgv dropdownlist dropdownmenu dynamic dynamically edit embeddingactivexcontrol fileuploader fill findcontrol flash flv formatdecimal formview gridview gudi iframe iis javascript listbox menu microsoft mouse mssql multistepregistration nameisnotdeclared news opera panelmasterpagebuttoncontrols problem redirect registration relationaldatabases reportemail schoolproject security serializesmo.table sessionvariables silverlight smartcard smoobjects software sql sql-server sqlserver2005 ssl textbox tracking treeview unauthorized validatedate validation vb.net video videos virtualdirectory vista visual-studio visualstudio web webapplications webarchitecture webdevelopemnt webdevelopment webprogramming webservice youareanotmemberofthedebuggerusers





