Click here to Skip to main content
15,889,281 members
Home / Discussions / C#
   

C#

 
GeneralRe: AppDomain and singleton pattern Pin
Chris Richner29-Oct-03 5:59
Chris Richner29-Oct-03 5:59 
GeneralRe: AppDomain and singleton pattern Pin
Heath Stewart29-Oct-03 7:54
protectorHeath Stewart29-Oct-03 7:54 
Generalconvert byte array to float data Pin
zecodela27-Oct-03 18:45
zecodela27-Oct-03 18:45 
GeneralRe: convert byte array to float data Pin
Heath Stewart28-Oct-03 2:56
protectorHeath Stewart28-Oct-03 2:56 
QuestionHow to set ACEs on AD classes Pin
Nidhi Narang27-Oct-03 12:41
Nidhi Narang27-Oct-03 12:41 
AnswerRe: How to set ACEs on AD classes Pin
Erick Sgarbi27-Oct-03 13:42
Erick Sgarbi27-Oct-03 13:42 
GeneralRe: How to set ACEs on AD classes Pin
Nidhi Narang28-Oct-03 5:46
Nidhi Narang28-Oct-03 5:46 
QuestionsqlDataReader Thread Safe? Pin
michin127-Oct-03 11:01
michin127-Oct-03 11:01 
I'm having a wierd issue where i run a query in a thread and the while(Connection.read()) duplicates my results. Anyone else have this issue? For isntance if I have TestTable with the following values:

TestID
1
2
3

It will console.writeline
1
1
2
2
3
3


Below is sample code:

private void button3_Click(object sender, System.EventArgs e)
{
ThreadStart DBThread = new ThreadStart(StartDBDelegate) ;
Thread DB = new Thread(DBThread) ;
DB.Start();
}

public void StartDBDelegate)()
{

Invoke(new UpdateLoadTableDelegate(RunUpdateNow));

}

public void RunUpdateNow()
{


string source =
"server=testserver;uid=testuid;pwd=testpassword;database=TestDB";

string selectconn1 = "SELECT TestID as dbTestID FROM TestTable"

SqlConnection conn1 = new SqlConnection(source);
conn1.Open();
SqlCommand executeconn1 = new SqlCommand(selectconn1,conn1);
SqlDataReader Connection1 = executeconn1.ExecuteReader();


while(Connection1.Read())
{
Console.WriteLine (Connection1[0].ToString())
}
}



I can reduce this menace by doing the following to the while loop, although I shouldnt have to do this...this is really bugging me. It doesnt do this outside of the thread.

string strTestID = "";

while(Connection1.Read())
{
if(strTestID != Connection1[0].ToString()))
{
Console.WriteLine (Connection1[0].ToString())

strTestID = Connection1[0].ToString());
}

}


GeneralTimeZones in .Net Pin
Vadim Tabakman27-Oct-03 10:41
Vadim Tabakman27-Oct-03 10:41 
GeneralRe: TimeZones in .Net Pin
Heath Stewart27-Oct-03 11:07
protectorHeath Stewart27-Oct-03 11:07 
GeneralRe: TimeZones in .Net Pin
Vadim Tabakman27-Oct-03 11:14
Vadim Tabakman27-Oct-03 11:14 
GeneralRe: TimeZones in .Net Pin
Heath Stewart27-Oct-03 11:17
protectorHeath Stewart27-Oct-03 11:17 
Generalprogress bar to use on .net web client Pin
john51327-Oct-03 8:47
john51327-Oct-03 8:47 
GeneralRe: progress bar to use on .net web client Pin
Heath Stewart27-Oct-03 10:19
protectorHeath Stewart27-Oct-03 10:19 
GeneralArrayList and Binary Search Pin
RB@Emphasys27-Oct-03 8:26
RB@Emphasys27-Oct-03 8:26 
GeneralRe: ArrayList and Binary Search Pin
Heath Stewart27-Oct-03 8:37
protectorHeath Stewart27-Oct-03 8:37 
GeneralRe: ArrayList and Binary Search Pin
RB@Emphasys27-Oct-03 9:05
RB@Emphasys27-Oct-03 9:05 
GeneralRe: ArrayList and Binary Search Pin
leppie27-Oct-03 8:38
leppie27-Oct-03 8:38 
GeneralRe: ArrayList and Binary Search Pin
Jeremy Kimball28-Oct-03 10:32
Jeremy Kimball28-Oct-03 10:32 
GeneralRe: ArrayList and Binary Search Pin
RB@Emphasys29-Oct-03 3:06
RB@Emphasys29-Oct-03 3:06 
GeneralActive X (ocx) into web project Pin
@LX27-Oct-03 7:25
@LX27-Oct-03 7:25 
GeneralRe: Active X (ocx) into web project Pin
Heath Stewart27-Oct-03 8:08
protectorHeath Stewart27-Oct-03 8:08 
GeneralHTML Processing in Windows Application Pin
Inam27-Oct-03 7:25
Inam27-Oct-03 7:25 
GeneralRe: HTML Processing in Windows Application Pin
Heath Stewart27-Oct-03 8:12
protectorHeath Stewart27-Oct-03 8:12 
Generalform object's constructor Pin
coolerbob27-Oct-03 6:30
coolerbob27-Oct-03 6:30 

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.