Mustafa,
The best way to do this is to use a stored procedure on the database that
when the procedure is finished doing its insert which generates the
auto-gen'd number for the primary key, use RETURN @@SCOPE_IDENTITY at the
end of your stored proc, and capture this as a return value in VB. Saves a
round trip to the DB server to go back and get the value using a large where
clause, and you don't have datareader overhead.
Aiax
"MUSTAFA IRSHAD" <MU**********@YAHOO.COM> wrote in message
news:2E**********************************@microsof t.com...
DEAR SIRS,
I AM DEVELOPING A SOFTWARE BY USING VB.NET AND SQLSERVER 2000 FOR A
NETWORK ENVIRONMENT. I HAVE A BROBLEM THAT I HAVE A FIELD FOR PRIMERY KEY
WHICH IS AUTO GENERATED. I NEED THAT WHEN THE FORM IS LOADED THE NEXT AUTO
GENERATED NO SHOULD BE IN THE REQUIRED TEXTBOX. HOW TO GET THE NEXT NUMBER
FROM SQLSERVER2000 TO TEXTBOX.
I WILL APPRICIAT YOUR COOPERATION.
MUSTAFA IRSHAD