Click here to Skip to main content
15,905,913 members
Home / Discussions / C#
   

C#

 
GeneralRe: char & string? Pin
CPallini4-Jan-09 5:52
mveCPallini4-Jan-09 5:52 
GeneralRe: char & string? Pin
Colin Angus Mackay4-Jan-09 5:54
Colin Angus Mackay4-Jan-09 5:54 
GeneralRe: char & string? Pin
Guffa4-Jan-09 8:19
Guffa4-Jan-09 8:19 
GeneralRe: char & string? Pin
#realJSOP4-Jan-09 11:00
professional#realJSOP4-Jan-09 11:00 
AnswerRe: char & string? Pin
CodingYoshi4-Jan-09 16:00
CodingYoshi4-Jan-09 16:00 
GeneralRe: char & string? Pin
Guffa4-Jan-09 16:23
Guffa4-Jan-09 16:23 
GeneralRe: char & string? Pin
CodingYoshi5-Jan-09 5:29
CodingYoshi5-Jan-09 5:29 
QuestionGeneric List-Getting rows and passing them as params to sproc Pin
kenny23454-Jan-09 1:48
kenny23454-Jan-09 1:48 
If I test this code using static data and bypass the loop this function works ok.
eg
long _item0 = 98855669;
long _item1 = 457788996630; etc

The LIVE data is held in a generic List which is updated during the users session, items are added/removed by the user.
Now when I come to save the selection in the database I need to loop out all the selected items and send them to the SP below.

protected void InsertSeletedProducts(string StrConn)
{

UsersWeb.Cart objCart = (UsersWeb.Cart)Session["Cart"];//Gets the details of the users session including the Products list they selected

long _item0 = 0; //If I add static data here and bypass the loop for testing the function works ok
long _item1 = 0;
long _item2 = 0;
long _item3 = 0;
long _item4 = 0;

foreach (UsersWeb.Products objProducts in objCart.Products) //LOOP/iterate the Generic Products list for all the selected items
{
_item0 = ?; //here I need code to match each UniqueID rows in the list and add them to the Params list for the SP below
_item1 = ?;
_item2 = ?;
_item3 = ?;
_item4 = ?;
}
SqlCommand cmd = new SqlCommand("usp_InsertSelectedItems", new SqlConnection(StrConn));
cmd.CommandType = CommandType.StoredProcedure;

cmd.Parameters.AddWithValue("@item1", _item0);
cmd.Parameters.AddWithValue("@item2", _item1);
cmd.Parameters.AddWithValue("@item3", _item2);
cmd.Parameters.AddWithValue("@item4", _item3);
cmd.Parameters.AddWithValue("@item5", _item4);
cmd.Connection.Open();
cmd.ExecuteNonQuery();

}

Can anyone help??
AnswerRe: Generic List-Getting rows and passing them as params to sproc Pin
Wendelius4-Jan-09 3:16
mentorWendelius4-Jan-09 3:16 
QuestionOne prolem of Axis set by using MS chart control Pin
Seraph_summer4-Jan-09 1:16
Seraph_summer4-Jan-09 1:16 
QuestionMessage Removed Pin
4-Jan-09 0:30
Fired.Fish.Gmail4-Jan-09 0:30 
AnswerRe: One Regular Expression Pin
User 66584-Jan-09 1:29
User 66584-Jan-09 1:29 
QuestionConvert.ToByte('Š') throws an exception Pin
lackonagy3-Jan-09 20:49
lackonagy3-Jan-09 20:49 
AnswerRe: Convert.ToByte('Š') throws an exception PinPopular
Dewald3-Jan-09 21:46
Dewald3-Jan-09 21:46 
AnswerRe: Convert.ToByte('Š') throws an exception Pin
Dragonfly_Lee4-Jan-09 22:03
Dragonfly_Lee4-Jan-09 22:03 
Questionhow to restrict only one instance to run at a time on one machine Pin
prasadbuddhika3-Jan-09 17:36
prasadbuddhika3-Jan-09 17:36 
AnswerRe: how to restrict only one instance to run at a time on one machine Pin
N a v a n e e t h3-Jan-09 18:06
N a v a n e e t h3-Jan-09 18:06 
GeneralRe: how to restrict only one instance to run at a time on one machine Pin
prasadbuddhika3-Jan-09 18:50
prasadbuddhika3-Jan-09 18:50 
GeneralRe: how to restrict only one instance to run at a time on one machine Pin
N a v a n e e t h3-Jan-09 19:42
N a v a n e e t h3-Jan-09 19:42 
QuestionRounding a float to the nearest int Pin
Tony Pottier3-Jan-09 13:38
Tony Pottier3-Jan-09 13:38 
AnswerRe: Rounding a float to the nearest int Pin
PIEBALDconsult3-Jan-09 13:46
mvePIEBALDconsult3-Jan-09 13:46 
QuestionRemote event update RichTextBox problem Pin
ZarazaPhd3-Jan-09 8:05
ZarazaPhd3-Jan-09 8:05 
GeneralRe: Remote event update RichTextBox problem Pin
Luc Pattyn3-Jan-09 8:51
sitebuilderLuc Pattyn3-Jan-09 8:51 
GeneralRe: Remote event update RichTextBox problem Pin
ZarazaPhd3-Jan-09 9:10
ZarazaPhd3-Jan-09 9:10 
GeneralRe: Remote event update RichTextBox problem Pin
Luc Pattyn3-Jan-09 9:44
sitebuilderLuc Pattyn3-Jan-09 9:44 

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.