Click here to Skip to main content
15,920,603 members
Home / Discussions / C#
   

C#

 
GeneralRe: Control Button Doubleclick Pin
Mr. Labenche21-Oct-03 23:16
Mr. Labenche21-Oct-03 23:16 
GeneralRe: Control Button Doubleclick Pin
Heath Stewart22-Oct-03 2:52
protectorHeath Stewart22-Oct-03 2:52 
GeneralRe: Control Button Doubleclick Pin
Mr. Labenche22-Oct-03 3:07
Mr. Labenche22-Oct-03 3:07 
GeneralRe: Control Button Doubleclick Pin
Heath Stewart22-Oct-03 3:18
protectorHeath Stewart22-Oct-03 3:18 
QuestionHow to connect to a Solaris Unix box from .NET using sockets or tcpclient Pin
Buckin20-Oct-03 21:44
Buckin20-Oct-03 21:44 
AnswerRe: How to connect to a Solaris Unix box from .NET using sockets or tcpclient Pin
Heath Stewart21-Oct-03 6:53
protectorHeath Stewart21-Oct-03 6:53 
GeneralHelp in color of Datagrid Pin
erbest20-Oct-03 17:49
erbest20-Oct-03 17:49 
GeneralAdvice Pin
gadgetfbi20-Oct-03 16:17
gadgetfbi20-Oct-03 16:17 
I’m a bit of a nubie and looking for some advice, the code bellow works but looks like a bit of a hack. I know it's a 'WebMethod' its general enough. My concerns lie with the 'Populate product' section toward the bottom.

[WebMethod]<br />
		public Product GetProductById(int Id)<br />
		{<br />
			#region oleDbQueery<br />
			// Connect to dataSource<br />
			OleDbDataAdapter myAdapter = new OleDbDataAdapter();<br />
			OleDbCommand myCommand = new OleDbCommand("ProductByIdQueery", oleDbConnection1);<br />
			myCommand.CommandType = CommandType.StoredProcedure;<br />
			OleDbParameter parameterid = new OleDbParameter("Id",OleDbType.Integer);<br />
			parameterid.Value = Id;<br />
			myCommand.Parameters.Add(parameterid);<br />
			myAdapter.SelectCommand = oleDbSelectCommand1;<br />
			myAdapter.SelectCommand = myCommand;<br />
			// Populate dataSet<br />
			#endregion<br />
			DataSet ds = new DataSet();<br />
			oleDbConnection1.Open();<br />
			myAdapter.Fill(ds);<br />
			oleDbConnection1.Close();<br />
			// Populate product<br />
			Product myProduct = new Product();<br />
			myProduct.Id = Int32.Parse(ds.Tables[0].Rows[0]["Id"].ToString());<br />
			myProduct.Category = Int32.Parse(ds.Tables[0].Rows[0]["Category"].ToString());<br />
			myProduct.ShortTitle = ds.Tables[0].Rows[0]["ShortTitle"].ToString();<br />
			myProduct.FullTitle = ds.Tables[0].Rows[0]["FullTitle"].ToString();<br />
			myProduct.Price = double.Parse(ds.Tables[0].Rows[0]["Price"].ToString());<br />
			myProduct.CurrentQuantity = Int32.Parse(ds.Tables[0].Rows[0]["CurrentQuantity"].ToString());<br />
			//<br />
			return myProduct;<br />
		}


Sorry for the long snippit. My passed in 'Id' would refer to a unique db key so the dataSet 'should' only ever contain one row.
Do I have to go via a dataSet to populate myProduct object?

All comments greatly welcomed.

tia
GeneralRe: Advice Pin
Guillermo Rivero20-Oct-03 16:47
Guillermo Rivero20-Oct-03 16:47 
GeneralRe: Advice Pin
Bo Hunter20-Oct-03 18:05
Bo Hunter20-Oct-03 18:05 
GeneralRe: Advice Pin
leppie21-Oct-03 8:59
leppie21-Oct-03 8:59 
GeneralMultilple Monitors Pin
Jeff Monheiser20-Oct-03 9:00
Jeff Monheiser20-Oct-03 9:00 
GeneralRe: Multilple Monitors Pin
igor196020-Oct-03 9:36
igor196020-Oct-03 9:36 
GeneralRe: Multilple Monitors Pin
Heath Stewart20-Oct-03 10:35
protectorHeath Stewart20-Oct-03 10:35 
GeneralRe: Multilple Monitors Pin
leppie21-Oct-03 11:58
leppie21-Oct-03 11:58 
QuestionWhats wrong with this datagrid code? Pin
RB@Emphasys20-Oct-03 8:32
RB@Emphasys20-Oct-03 8:32 
AnswerRe: Whats wrong with this datagrid code? Pin
RB@Emphasys20-Oct-03 8:46
RB@Emphasys20-Oct-03 8:46 
GeneralRe: Whats wrong with this datagrid code? Pin
RB@Emphasys20-Oct-03 8:49
RB@Emphasys20-Oct-03 8:49 
GeneralAsyncCallBack and COM+ Pin
rick close20-Oct-03 8:09
rick close20-Oct-03 8:09 
GeneralRe: AsyncCallBack and COM+ Pin
Guillermo Rivero21-Oct-03 4:12
Guillermo Rivero21-Oct-03 4:12 
GeneralMouse Location Pin
Gary Kirkham20-Oct-03 7:30
Gary Kirkham20-Oct-03 7:30 
GeneralRe: Mouse Location Pin
Andreas Philipson20-Oct-03 8:24
Andreas Philipson20-Oct-03 8:24 
GeneralRe: Mouse Location Pin
Gary Kirkham20-Oct-03 9:03
Gary Kirkham20-Oct-03 9:03 
Generalfind I/O devices! Pin
waleed riaz20-Oct-03 1:49
waleed riaz20-Oct-03 1:49 
GeneralRe: find I/O devices! Pin
Heath Stewart20-Oct-03 6:20
protectorHeath Stewart20-Oct-03 6:20 

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.