Click here to Skip to main content
15,887,822 members
Home / Discussions / Database
   

Database

 
GeneralRe: Problems Formating Datagrid Output Pin
TofuBug2421-Nov-05 1:33
TofuBug2421-Nov-05 1:33 
GeneralRe: Problems Formating Datagrid Output Pin
S Douglas22-Nov-05 1:18
professionalS Douglas22-Nov-05 1:18 
QuestionDataGrid & DataRelation Pin
RoyRose7820-Nov-05 5:03
RoyRose7820-Nov-05 5:03 
QuestionHow to Kill a process in procedure? Pin
GflPower19-Nov-05 20:32
GflPower19-Nov-05 20:32 
AnswerRe: How to Kill a process in procedure? Pin
WoutL21-Nov-05 9:17
WoutL21-Nov-05 9:17 
QuestionSql Scripts in C# Pin
da vinci coder19-Nov-05 17:56
da vinci coder19-Nov-05 17:56 
AnswerRe: Sql Scripts in C# Pin
Colin Angus Mackay20-Nov-05 8:13
Colin Angus Mackay20-Nov-05 8:13 
Questionreturning guid from row jsut added Pin
g00fyman19-Nov-05 15:53
g00fyman19-Nov-05 15:53 
hi all,

i have an procedure as follows:

ALTER PROCEDURE dbo.InsertNewSite
(
	@param_url nchar(250),
	@param_ip nchar(15),
	@param_username uniqueidentifier,
	@param_time datetime
)
AS
	SET NOCOUNT OFF;
INSERT INTO sites
                      (url, ip_address, username, access_time)
VALUES     (@param_url,@param_ip,@param_username,@param_time)

RETURN SELECT id FROM sites WHERE sites.url = @param_url AND sites.access_time = @param_time 


and it is called from code like this:
string newSiteId = "";
      // add the new site to the database
      lock (this.selectAllSitesNotBannedTableAdapter)
      {
        newSiteId = (string)this.selectAllSitesNotBannedTableAdapter.InsertNewSiteNotBanned(host, requestor, new Guid("bcadf8d7-c96d-4981-bf26-de9915ac6d49"), DateTime.Now);
      }


but newSiteId always returns null?

now to explain the problem i am trying to solve with this code:
i get some data i want to store into the db, the db generates the GUID for the new row, and i then need that GUID in my application. so rather than reloading the entire datagrid, i just add the row to the grid that i just added to the db.

is it possible to get the GUID of the row just added, in one call to the db, or do i need to call it again with the select that is the return statement above ?

kind regards,
g00fy
QuestionSave difficult ...!!! Pin
mostafa_h19-Nov-05 4:55
mostafa_h19-Nov-05 4:55 
Questiontrying to install SQL SERVER 2000 Pin
microuser_200019-Nov-05 3:51
microuser_200019-Nov-05 3:51 
AnswerRe: trying to install SQL SERVER 2000 Pin
Colin Angus Mackay19-Nov-05 10:08
Colin Angus Mackay19-Nov-05 10:08 
Questionreplace single quotes in SELECT Pin
jszpila18-Nov-05 6:43
jszpila18-Nov-05 6:43 
AnswerRe: replace single quotes in SELECT Pin
Colin Angus Mackay18-Nov-05 13:44
Colin Angus Mackay18-Nov-05 13:44 
QuestionSQL Reporting Services Error Pin
utsav_verma17-Nov-05 19:07
utsav_verma17-Nov-05 19:07 
QuestionA Transact-SQL Question Pin
Xiaoming Qian16-Nov-05 20:37
Xiaoming Qian16-Nov-05 20:37 
AnswerRe: A Transact-SQL Question Pin
Grav-Vt17-Nov-05 12:56
Grav-Vt17-Nov-05 12:56 
Questionscope identity not a function name Pin
kal2na216-Nov-05 19:37
kal2na216-Nov-05 19:37 
AnswerRe: scope identity not a function name Pin
Grav-Vt17-Nov-05 12:57
Grav-Vt17-Nov-05 12:57 
QuestionCheck for a string of SPACE characters Pin
Chris Meech16-Nov-05 9:06
Chris Meech16-Nov-05 9:06 
QuestionSQL code coverage Pin
Paul Watson16-Nov-05 3:23
sitebuilderPaul Watson16-Nov-05 3:23 
QuestionRe: SQL code coverage Pin
Chris Meech16-Nov-05 9:10
Chris Meech16-Nov-05 9:10 
AnswerRe: SQL code coverage Pin
Paul Watson16-Nov-05 9:22
sitebuilderPaul Watson16-Nov-05 9:22 
QuestionTying a XML playlist to SQL data Pin
normschaef15-Nov-05 11:56
normschaef15-Nov-05 11:56 
Questionschema design question Pin
ppp00115-Nov-05 6:44
ppp00115-Nov-05 6:44 
AnswerRe: schema design question Pin
Daniel Santillanes15-Nov-05 7:00
professionalDaniel Santillanes15-Nov-05 7:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.