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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Insert - Sqlserver 2005 - Primary Key Field

Author  Topic 

paramu
Posting Yak Master

151 Posts

Posted - 2009-05-14 : 00:39:08
Hi,
Iam using Sqlserver 2005. I have a problem with insert statement. But, without primary key this statement is working good. But if I set the primary key, then it's not inserting. this is the first time Iam using the primary key fields.

Better Ideas Always Welcome.

From the below, field "emp_id" is primary key field.

insert into sec_erb_id (emp_id,sec_id_no,[sec_id_expiry]) values ('" & MyDataGrid1.Rows(Rjim).Cells(0).Value & "','" & MyDataGrid1.Rows(Rjim).Cells(2).Value & "','" & MyDataGrid1.Rows(Rjim).Cells(3).Value & "' )"



Paramu @ PARANTHAMAN

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2009-05-14 : 01:21:23
Do you have an error message like duplicate key?


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

paramu
Posting Yak Master

151 Posts

Posted - 2009-05-14 : 01:31:45
No any errors just hangup, may be anything like index is required?

Thanks Again

Paramu @ PARANTHAMAN
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2009-05-14 : 03:14:03
So if your app is not displaying any error message I would advice to do code a display of that ready to use transformed statement. then copy and paste in a query window and see what happens...


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page
   

- Advertisement -