Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
revital
Starting Member
2 Posts |
Posted - 2003-02-03 : 03:12:15
|
HI, I TRIED TO INSERT VALUE USING VB TO COLOUM THAT HAVE CHECK CONSTRAIN IN THE TABEL DISSINE . THE DATABAS IS SQL 7. THE CODE IS:Public stud_conn As New ADODB.Connection Public stud_rs As New ADODB.Recordset Private Sub Command1_Click() stud_conn.Close End Sub Private Sub Command2_Click() Dim a As String a = Trim(Text2.Text) stud_conn.Execute "insert into stud_info(city)values (' " & a & " ')" End Sub Private Sub Form_Load() stud_conn.Open "Provider=SQLOLEDB.1;Persist Security Info=false;" _ & "User ID=einat;Initial Catalog=STUD_2;Data Source=oemcomputer" If stud_conn.State = adStateOpen Then L1.Caption = "WWELL CONN" Else L1.Caption = "NO CONN" End If End Sub THE ERROR MESSEGE IS: RUNTIME ERROR -2147217900(80040E14) INSERT STAEMENT CONFICTED WITH TABLE CHECK CONSTRAINT 'CK_STUD_INFO' in text2.text i insert value like ny that has been define in chack constraint, on this way: [city]='ny' or [city]='wt' on the coloum city. city is not index ' key , duplicate or others, it can be even null/ when i use in the insert conmmand the value 'ny', its go withuot error , but when i use to send the data using textbox ther is runtime error. WHERE IS MY MISTAK?? THANKS |
|
|
|
|