'System Data OleDb OleDbException: 'No value given for one or more required parameters.'
https://i.stack.imgur.com/VBvoy.png https://i.stack.imgur.com/sSAci.png
Everytime I Submit the form, instead of sending me the info in Access it gives me this error.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web.Security;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
public partial class _Default : System.Web.UI.Page
{
public string fn = "", sn = "", un = "", ea = "", pa = "", by = "", co = "", msg2 = "";
protected void Page_Load(object sender, EventArgs e)
{
string sqlS = "";
string fileName = "RegDatabase.mdb";
if (IsPostBack)
{
fn = Request.Form["first_name"];
sn = Request.Form["sur_name"];
un = Request.Form["user_name"];
ea = Request.Form["email_address"];
pa = Request.Form["pass"];
by = Request.Form["birth_year"];
co = Request.Form["country"];
int bYear = int.Parse(by);
string selectQuery = "SELECT * FROM [SignUpDatabase] WHERE User_name = '" + un + "'";
if (!MyAdoHelper.IsExist(fileName, selectQuery))
{
sqlS = "INSERT INTO [SignUpDatabase] VALUES ('" + fn + "','" + sn + "','" + un + "'," + ea + "'," + pa + "'," + by + "'," + co + ")";
MyAdoHelper.DoQuery(fileName, sqlS);
}
}
}
}
this is the code if you need it. idk what more detail to give you.
Solution 1:[1]
Use the correct syntax - and by should be numeric.:
sqlS = "INSERT INTO [SignUpDatabase] VALUES ('" + fn + "','" + sn + "','" + un + "','" + ea + "','" + pa + "'," + by + ",'" + co + "')";
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Gustav |
