![]() ![]() ![]() ![]() |
|||||
|
|||||
樓主 小黑 ![]()
![]() |
{ if (Page.IsValid) { string ConnString; ConnString = "Data Source=.\\SQLEXPRESS;AttachDbFilename=|DataDirectory|\\People.mdf;Integrated Security=True;User Instance=True"; string querystring = "Select * From Table1 where 帳號 = '" + txtAct.Text + "'"; SqlConnection connection = new SqlConnection(ConnString); connection.Open(); SqlCommand cmd = new SqlCommand(querystring, connection); SqlDataReader reder = cmd.ExecuteReader(); if (txtAct.Text != "" && txtPsd.Text != "" && txtMail.Text != "" && txtBdy.Text != "" && txtName.Text != "") { if (reder.Read()) { lblMsg.ForeColor = System.Drawing.Color.Red; lblMsg.Text = "已有重覆的帳號!"; } else { lblMsg.Text = "註冊成功"; SqlDataSource1.Insert(); } } else lblMsg.Text = "未輸入完全!"; } } } 無法插入 NULL 值到資料行 '帳號',資料表 'C:\USERS\USER\DESKTOP\網頁專題\APP_DATA\PEOPLE.MDF.dbo.Table1'; 資料行不得有 Null。INSERT 失敗。 陳述式已經結束 找不出原因
搜尋相關Tags的文章:
[ 無法插入 NULL ] ,
本篇文章發表於2013-12-18 21:36 |
1樓 |
1. SqlDataSource1 沒有看到語法
2. txtAct.Text 有抓到值嗎 先驗證一下 txtAct.Text 不可為null
本篇文章回覆於2013-12-18 22:12
== 簽名檔 ==
--未登入的會員無法查看對方簽名檔-- |
2樓 |
SQL Injection
本篇文章回覆於2013-12-19 11:44
== 簽名檔 ==
--未登入的會員無法查看對方簽名檔-- |
3樓 |
這是 SQL Injection 教材嗎?
本篇文章回覆於2013-12-19 12:56
== 簽名檔 ==
--未登入的會員無法查看對方簽名檔-- |
4樓 |
把資料庫中該table的欄位 設定成允許null
本篇文章回覆於2013-12-19 23:21
== 簽名檔 ==
--未登入的會員無法查看對方簽名檔-- |
5樓 |
我認為是找錯了文件,請先確認txtAct.Text是否確實的導入了。
建議你先把回傳的結果 response.write 出來看看,好檢查一下系統能否找到對應的文檔。
本篇文章回覆於2014-01-10 17:37
== 簽名檔 ==
--未登入的會員無法查看對方簽名檔-- |
回覆 |
如要回應,請先登入. |