![](/img/trans.png)
[英]System.Data.OleDb.OleDbException: 'No value given for one or more required parameters.' ERROR
[英]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
每次我提交表單時,它都會給我這個錯誤,而不是在 Access 中向我發送信息。
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); } } } }
如果您需要,這是代碼。 我想給你更多細節。
使用正確的語法 - by
應該是數字。:
sqlS = "INSERT INTO [SignUpDatabase] VALUES ('" + fn + "','" + sn + "','" + un + "','" + ea + "','" + pa + "'," + by + ",'" + co + "')";
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.