[C#] ทำ Login ครับ แล้วมันบอกว่า ไม่มีฟิล นั้นๆ มีภาพครับ ช่วยที help me
Code ?
Date :
2012-01-13 09:38:05
By :
webmaster
Code (C#)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.OleDb;
namespace WindowsFormsApplication1
{
class TableUser : AccessDatabase
{
public bool AddNewUser(string UserName, string UserPassword, string UserEmail)
{
bool Success = false;
if (!IsUser(UserName))
{
base.CommandString = "Insert Into [Table_User] ([UserName], [UserPassword], [UserEmail]) Values (@UserName, @UserPassword, @UserEmail)";
base.AddParameter("@UserName", OleDbType.VarChar, UserName);
base.AddParameter("@UserPassword", OleDbType.VarChar, UserPassword);
base.AddParameter("@UserEmail", OleDbType.VarChar, UserEmail);
Success = base.ExecuteNonQuery();
}
return Success;
}
private bool IsUser(string UserName)
{
bool HaveUser = false;
base.CommandString = "Select Count(*) From [Table_User] Where [UserName]=@USerName";
base.AddParameter("@UserName", OleDbType.VarChar, UserName);
int User = (int)base.ExecuteScalar();
if (User > 0)
HaveUser = true;
return HaveUser;
}
}
}
Date :
2012-01-13 09:39:18
By :
pongtanakorn
แล้วใน ฐานข้อมูลผม ก็ สร้างชื่อ AccessDatabase.mdb มี 3 ฟิล 1 UserName 2 UserEmail 3 UserPassword
Date :
2012-01-13 09:40:42
By :
pongtanakorn
Error Line ไหนครับ ลอง Debug ดูครับ
Date :
2012-01-13 09:54:10
By :
webmaster
มันบอกเหมือนในภาพอ่ะครับ Debug แล้ว เพิ่ม นำเข้าฐานข้อมูลไม่ได้ มันบอก หา ฟิลไม่เจอแบบในภาพ หรือจะลอง บังคับเครื่องผมทางทีมวิวดูครับ
Date :
2012-01-13 10:03:31
By :
pongtanakorn
ช่วยด้วยครับ
Date :
2012-01-13 11:27:26
By :
pongtanakorn
-*-
Date :
2012-01-13 15:47:39
By :
pongtanakorn
ผมว่า บรรทัดนี้ นะ
Code (C#)
base.CommandString = "Select Count(*) From [Table_User] Where [UserName]=@USerName";
แก้เป็น
Code (C#)
base.CommandString = "Select Count(*) From [Table_User] Where [UserName]=@UserName";
ลองดูครับ
Date :
2012-01-16 21:37:41
By :
fhackman
Hackman - ก็ยังไม่ได้ครับ ดดูไม่รู้กีรอบแล้ว ก็ยังบอกว่า หาฟิวไม่เจอ -*-
Date :
2012-01-17 15:52:51
By :
pongtanakorn
ในฐานข้อมูลมี 3 ฟิล แล้วทำไมใน form กรอกข้อมูล 4 ตัวค่ะ (เกี่ยวกันรึเปล่าเอ่ย)
Date :
2012-01-21 17:27:25
By :
OoO
ต้องเข้าไปดูที่ base class ด้วยครับ error ไม่เกี่ยวกันเลย มีการดัก try catch ตรงไหนของ base class รึเปล่า มันจะต้องได้ system error มาด้วยครับ บอกมาสั้น ๆ แบบนี้ไม่น่าใช่
Date :
2012-01-21 19:26:37
By :
gunnermontana
Load balance : Server 01