Click here to Skip to main content
16,013,581 members
Home / Discussions / Database
   

Database

 
GeneralADO.net - Data source doesn't recognise my dataset Pin
savagerx31-Aug-04 6:53
savagerx31-Aug-04 6:53 
GeneralRe: ADO.net - Data source doesn't recognise my dataset Pin
Rocky Moore31-Aug-04 20:05
Rocky Moore31-Aug-04 20:05 
GeneralStored Proc not returning my Output Pin
matthias s.31-Aug-04 3:51
matthias s.31-Aug-04 3:51 
GeneralRe: Stored Proc not returning my Output Pin
Michael P Butler31-Aug-04 4:45
Michael P Butler31-Aug-04 4:45 
GeneralRe: Stored Proc not returning my Output Pin
matthias s.31-Aug-04 4:55
matthias s.31-Aug-04 4:55 
GeneralRe: Stored Proc not returning my Output Pin
Michael P Butler31-Aug-04 5:07
Michael P Butler31-Aug-04 5:07 
GeneralRe: Stored Proc not returning my Output Pin
bnieland31-Aug-04 5:00
bnieland31-Aug-04 5:00 
GeneralSolution found! Pin
matthias s.31-Aug-04 5:19
matthias s.31-Aug-04 5:19 
Hi DTrent!

Thanks for your reply. Your sole proposal has answered my question ("out of the command object..."??? Smile | :) )

I assumed, that the value gets automatically assigned once the SqlCommand.ExecuteScalar() call returns. I didn't know that I have to retrieve the SqlParameter.Value property and assign it then to the variable which I passed to that parameter. Seems kind of weird to me, in the end I'm asking why am I assigning the variable in the first place?

For those interested, here the code:
<br />
            int nResult = 0;<br />
            DateTime dtResult = new DateTime(0);<br />
            SqlCommand cmd = new SqlCommand(ProcName, Open());<br />
<br />
            try {<br />
                cmd.CommandType = System.Data.CommandType.StoredProcedure;<br />
<br />
				-- do stuff and and all params...<br />
                cmd.Parameters.Add(new SqlParameter("ElementID", ElementID));<br />
                cmd.Parameters.Add(new SqlParameter("DateModified", DateModified));<br />
<br />
                //  add the DateTime output param<br />
                SqlParameter prmNewDtModif = new SqlParameter("NewDateModified", dtResult);<br />
                prmNewDtModif.Direction = System.Data.ParameterDirection.Output;<br />
                cmd.Parameters.Add(prmNewDtModif);<br />
<br />
                nResult = (Int32) cmd.ExecuteScalar();<br />
				<br />
            }<br />
			<br />
			//	catch stuff omitted...<br />
			<br />
			//	To make the code work, uncomment the following line.<br />
			//	Omitting the following line, was actually the problem<br />
			//	but I thought, that the value (cause it got passed to the SqlParameter Ctor)<br />
			//	gets assigned automatically.<br />
			<br />
			//	dtResult = (DateTime) prmNewDtModif.Value;<br />
			<br />
			//	start using the dtResult variable<br />
			if (dtResult < dtSomething) {<br />
				//	go do stuff...<br />
			}<br />


Thanks for your help!

Matthias


If eell I ,nust draw to your atenttion to het fakt that I can splel perfrectly well - i;ts my typeying that sukcs.
(Lounge/David Wulff)

www.emvoid.de

GeneralTrace automation Pin
Deb22230-Aug-04 11:43
Deb22230-Aug-04 11:43 
GeneralDeriving from DataTable and adding rows in a different thread while displaying the table in a DataGrid. Pin
Michael Hulthin30-Aug-04 5:37
Michael Hulthin30-Aug-04 5:37 
GeneralSQL question Pin
NewPureLand28-Aug-04 18:00
NewPureLand28-Aug-04 18:00 
GeneralRe: SQL question Pin
NewPureLand28-Aug-04 19:38
NewPureLand28-Aug-04 19:38 
GeneralRe: SQL question Pin
Colin Angus Mackay28-Aug-04 22:55
Colin Angus Mackay28-Aug-04 22:55 
GeneralRe: SQL question Pin
mike.hall@lehigh.edu30-Aug-04 2:46
mike.hall@lehigh.edu30-Aug-04 2:46 
Generalfunctions Pin
jairajanbrothers27-Aug-04 23:42
jairajanbrothers27-Aug-04 23:42 
GeneralRe: functions Pin
Mazdak27-Aug-04 23:51
Mazdak27-Aug-04 23:51 
GeneralRe: functions Pin
Colin Angus Mackay28-Aug-04 2:04
Colin Angus Mackay28-Aug-04 2:04 
GeneralRe: functions Pin
Mazdak28-Aug-04 3:10
Mazdak28-Aug-04 3:10 
GeneralRe: functions Pin
Colin Angus Mackay28-Aug-04 4:31
Colin Angus Mackay28-Aug-04 4:31 
GeneralRe: functions Pin
Mazdak28-Aug-04 4:40
Mazdak28-Aug-04 4:40 
GeneralRe: functions Pin
Colin Angus Mackay28-Aug-04 2:04
Colin Angus Mackay28-Aug-04 2:04 
GeneralRe: functions Pin
Rocky Moore31-Aug-04 19:55
Rocky Moore31-Aug-04 19:55 
GeneralMdb question Pin
jzb27-Aug-04 23:40
jzb27-Aug-04 23:40 
GeneralRe: Mdb question Pin
Colin Angus Mackay28-Aug-04 2:08
Colin Angus Mackay28-Aug-04 2:08 
Questionado.net connections and .dispose? Pin
Roger Alsing27-Aug-04 1:39
Roger Alsing27-Aug-04 1:39 

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.