I'm using a stored procedure with this sql:
INSERT INTO [dbTblUsers]([strUsername], [strPassword])
VALUES (@p1,@p2);
SELECT @@IDENTITY;
And calling the procedure:
// Insert new user
nId = daUsers.InsertQuery(textBoxUsername.Text, textBoxPassword.Text);
// Insert new Twitter OAuth
daTwitterOAuth.Insert(nId, textBoxConsumerKey.Text, textBoxConsumerSecret.Text, textBoxToken.Text, textBoxTokenSecret.Text);
How do I cast the object @@IDENTITY int the int nId? Like this?
nId = (int)daUsers.InsertQuery(textBoxUsername.Text, textBoxPassword.Text);