cc
2006-07-10 02:48:02 UTC
請問各位先進:
在新增資料時如何判斷資料是否重複...
假若我的DB是設計給會員註冊的AccountDB:
user_id(ini型態,每增加一筆會自動加1,也是Key欄位)
user_name(nvarchar型態) '不容許重覆
user_mail (nvarchar型態) '不容許重覆
Code:
Dim strSQL As String = " insert into sys_user (user_name...) values
(@user_name...)"
Dim myConnection As SqlConnection = new
SqlConnection(ConfigurationManager.AppSettings("dsn"))
Dim myCommand As SqlCommand = new SqlCommand strSQL, myConnection)
myCommand.Parameters.Add(new SqlParameter("@user_name", SqlDbType.NVarChar,
50))
myCommand.Parameters("@user_name").Value = user_account.Text
接下來要如何判斷...還是要改哪個部份?
謝謝^^
在新增資料時如何判斷資料是否重複...
假若我的DB是設計給會員註冊的AccountDB:
user_id(ini型態,每增加一筆會自動加1,也是Key欄位)
user_name(nvarchar型態) '不容許重覆
user_mail (nvarchar型態) '不容許重覆
Code:
Dim strSQL As String = " insert into sys_user (user_name...) values
(@user_name...)"
Dim myConnection As SqlConnection = new
SqlConnection(ConfigurationManager.AppSettings("dsn"))
Dim myCommand As SqlCommand = new SqlCommand strSQL, myConnection)
myCommand.Parameters.Add(new SqlParameter("@user_name", SqlDbType.NVarChar,
50))
myCommand.Parameters("@user_name").Value = user_account.Text
接下來要如何判斷...還是要改哪個部份?
謝謝^^