Row changes in SQL

  • Thread starter Thread starter Trevor
  • Start date Start date
T

Trevor

Hey,

I have a working front end to a northwind database but
when i add a row, i add the productID field as null so
when i try and update it, i get an error, but if i click
add then then close the program and then start it again
it will give it a unique number (next in the sequence).

How can i get it to automatically add a unique number
(next in sequence) when i click on add.

i have this code for the productID text.

oDR("ProductID") = txtID.Text = "0"

Can i just add a refresh command somewhere?
If so what format do i use.

Thanks
 
Hi Trevor,

Do not assign a value to the productid column - sql server or MS Access will
do it automatically.

HTH,

Bernie Yaeger
 
But then i get an error when trying to add a row, that
ProductID does not accept null values. so i must have to
set something?
 
Hi Trevor,

I assumed from your remarks that productid is an identity column and that it
is the table's pk. Evidently one or the other assumptions is incorrect or
there is something else I'm missing.

Please send me the bulk of the dataset open and then insert code; also, send
me the structure of the table in question. I'll be glad to try to figure it
out.

Bernie
 
Back
Top