Click here to Skip to main content
15,917,568 members
Home / Discussions / C#
   

C#

 
GeneralRe: Text Encoding Pin
Guinness4Strength30-Aug-05 9:51
Guinness4Strength30-Aug-05 9:51 
Questionregex Pin
surfman1930-Aug-05 9:04
surfman1930-Aug-05 9:04 
AnswerRe: regex Pin
Guffa30-Aug-05 9:16
Guffa30-Aug-05 9:16 
General[Message Deleted] Pin
surfman1930-Aug-05 9:24
surfman1930-Aug-05 9:24 
GeneralRe: regex Pin
surfman1930-Aug-05 9:28
surfman1930-Aug-05 9:28 
GeneralRe: regex Pin
User 665830-Aug-05 10:18
User 665830-Aug-05 10:18 
GeneralRe: regex Pin
Susan Hernandez31-Aug-05 15:31
Susan Hernandez31-Aug-05 15:31 
Questionforeach DataSet Pin
samoore30-Aug-05 6:19
samoore30-Aug-05 6:19 
I am trying to use a foreach to loop through a few datasets to update a table. With the code I have it is not working. I have checked both datasets with the quickwatch to make sure they are populated and they are. It runs through the code once, but on the second time through I get an error that the "SqlHelper.ExecuteScalar(Session["connect_string"].ToString(), System.Data.CommandType.Text, update).ToString();" statement, "Object not set to reference". I inserted a breakpoint and found that the Session variables are not changing in the update statement that I am creating. Any help would be appreciated.

foreach(DataTable mbTable in mb.Tables)
{
foreach(DataRow mbRow in mbTable.Rows)
{
Session["id"] = mbRow["m_id"].ToString();
Session["order"] = mbRow["m_ord_number"].ToString();

string dtdate = "SELECT stp_arrivaldate FROM stops WHERE ord_hdrnumber = '" + txtOrder.Text + "'";

DataSet dt = new DataSet();

dt = SqlHelper.ExecuteDataset(Session["connect_string"].ToString(),
System.Data.CommandType.Text, dtdate);

foreach(DataTable dtTable in dt.Tables)
{
foreach(DataRow dtRow in dtTable.Rows)
{
Session["dtdate"] = dtRow["stp_arrivaldate"].ToString();
string update = "UPDATE masterbrand_appt SET m_delivery_date = '" + Session["dtdate"].ToString() + "' WHERE m_id = '" + Session["id"].ToString() + "' AND m_ord_number = '" + Session["order"].ToString() + "'";

SqlHelper.ExecuteScalar(Session["connect_string"].ToString(),
System.Data.CommandType.Text, update).ToString();
}
}
}
}

Scott Moore

QuestionRe: foreach DataSet Pin
Guffa30-Aug-05 8:29
Guffa30-Aug-05 8:29 
AnswerRe: foreach DataSet Pin
samoore30-Aug-05 9:31
samoore30-Aug-05 9:31 
QuestionCustom Sinks Pin
esjq30-Aug-05 5:58
esjq30-Aug-05 5:58 
AnswerRe: Custom Sinks Pin
esjq30-Aug-05 21:37
esjq30-Aug-05 21:37 
QuestionTransparency not just in forms Pin
if_mel_yes_else_no30-Aug-05 5:57
if_mel_yes_else_no30-Aug-05 5:57 
QuestionInstalling application using C# Pin
Samar Aarkotti30-Aug-05 5:53
Samar Aarkotti30-Aug-05 5:53 
AnswerRe: Installing application using C# Pin
Guinness4Strength30-Aug-05 9:31
Guinness4Strength30-Aug-05 9:31 
GeneralRe: Installing application using C# Pin
Anonymous30-Aug-05 12:19
Anonymous30-Aug-05 12:19 
GeneralRe: Installing application using C# Pin
Guinness4Strength31-Aug-05 3:54
Guinness4Strength31-Aug-05 3:54 
QuestionQuestion about Mutex Pin
Alex Cutovoi30-Aug-05 5:17
Alex Cutovoi30-Aug-05 5:17 
AnswerRe: Question about Mutex Pin
Andy Brummer30-Aug-05 8:15
sitebuilderAndy Brummer30-Aug-05 8:15 
GeneralRe: Question about Mutex Pin
Alex Cutovoi30-Aug-05 9:25
Alex Cutovoi30-Aug-05 9:25 
GeneralRe: Question about Mutex Pin
Andy Brummer30-Aug-05 10:30
sitebuilderAndy Brummer30-Aug-05 10:30 
GeneralRe: Question about Mutex Pin
Alex Cutovoi30-Aug-05 14:17
Alex Cutovoi30-Aug-05 14:17 
GeneralRe: Question about Mutex Pin
Andy Brummer30-Aug-05 19:30
sitebuilderAndy Brummer30-Aug-05 19:30 
GeneralRe: Question about Mutex Pin
Alex Cutovoi31-Aug-05 2:53
Alex Cutovoi31-Aug-05 2:53 
GeneralRe: Question about Mutex Pin
Alex Cutovoi31-Aug-05 2:56
Alex Cutovoi31-Aug-05 2:56 

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.