in the backend that is in sqlserver 2000,
i created one table with all unique and not null columns.
in vb.net , i created a button called "insert" in which i wrote the code to enter the values in the backend.
and the code is as follows:
Try
cn.Open()
str = "insert into bankdet values (' " & TextBox1.Text & " ','" & TextBox2.Text & " ',' " & TextBox3.Text & " ') "
str1 = str.ToUpper.Trim(str)
cmd = New SqlCommand(str1, cn)
cmd.ExecuteNonQuery()
MsgBox(" UR RECORD IS SAVED")
Catch ex As SqlClient.SqlException
MessageBox.Show("RECORD ALREADY EXISTING... PLS ENTER DIFFERENT VALUES ")
Me.TextBox1.Focus()
TextBox1.Text = " "
TextBox3.Text = " "
End Try
but it is not working,it is accepting duplicate values sometimes.
i dont want to enter duplicate values irrespective of the columns.
if so display i want to display the error
do i need any modifications.
suggest
.
i created one table with all unique and not null columns.
in vb.net , i created a button called "insert" in which i wrote the code to enter the values in the backend.
and the code is as follows:
Try
cn.Open()
str = "insert into bankdet values (' " & TextBox1.Text & " ','" & TextBox2.Text & " ',' " & TextBox3.Text & " ') "
str1 = str.ToUpper.Trim(str)
cmd = New SqlCommand(str1, cn)
cmd.ExecuteNonQuery()
MsgBox(" UR RECORD IS SAVED")
Catch ex As SqlClient.SqlException
MessageBox.Show("RECORD ALREADY EXISTING... PLS ENTER DIFFERENT VALUES ")
Me.TextBox1.Focus()
TextBox1.Text = " "
TextBox3.Text = " "
End Try
but it is not working,it is accepting duplicate values sometimes.
i dont want to enter duplicate values irrespective of the columns.
if so display i want to display the error
do i need any modifications.
suggest
.