Click here to Skip to main content
15,882,315 members
Home / Discussions / C#
   

C#

 
AnswerRe: using System.Diagnostics.Stopwatch in an Button_Click Event: unusual results in specific test case Pin
Dave Kreskowiak25-Jul-13 1:15
mveDave Kreskowiak25-Jul-13 1:15 
GeneralRe: using System.Diagnostics.Stopwatch in an Button_Click Event: unusual results in specific test case Pin
BillWoodruff25-Jul-13 21:48
professionalBillWoodruff25-Jul-13 21:48 
GeneralRe: using System.Diagnostics.Stopwatch in an Button_Click Event: unusual results in specific test case Pin
Dave Kreskowiak26-Jul-13 7:00
mveDave Kreskowiak26-Jul-13 7:00 
GeneralRe: using System.Diagnostics.Stopwatch in an Button_Click Event: unusual results in specific test case Pin
BillWoodruff30-Jul-13 4:57
professionalBillWoodruff30-Jul-13 4:57 
GeneralRe: using System.Diagnostics.Stopwatch in an Button_Click Event: unusual results in specific test case Pin
Dave Kreskowiak30-Jul-13 5:46
mveDave Kreskowiak30-Jul-13 5:46 
AnswerRe: using System.Diagnostics.Stopwatch in an Button_Click Event: unusual results in specific test case PinPopular
Alan N25-Jul-13 4:27
Alan N25-Jul-13 4:27 
GeneralRe: using System.Diagnostics.Stopwatch in an Button_Click Event: unusual results in specific test case Pin
BillWoodruff25-Jul-13 21:13
professionalBillWoodruff25-Jul-13 21:13 
QuestionParamerterized OleDB Query Pin
gautamn199025-Jul-13 0:21
gautamn199025-Jul-13 0:21 
To suppress the warning CA2100 i am trying to create a parameterized query. By the following code.
C#
string sheet_name=listBox_Select_a_sheet.SelectedItem.ToString();

OleDbCommand cmd = MyConnection.CreateCommand();

cmd.CommandText = "SELECT count(*) FROM [?]";

cmd.Parameters.AddWithValue("?", sheet_name);

cmd.ExecuteNonQuery();

The value of the ? is not replaced.

I have also tried the following

C#
 OleDbCommand cmd = MyConnection.CreateCommand();

OleDbParameter para = new OleDbParameter("?", sheet_name);

cmd.Parameters.Add(para);

cmd.CommandText = "SELECT count(*) FROM [?]";

and

C#
string strSql = "SELECT count(*) FROM [@Name]";
cmd.Parameters.AddWithValue("@Name", sheet_name);

My aim is to replace the ? with the parameter.

And one more doubt is can we use parameterized query to replace a table name?
AnswerRe: Paramerterized OleDB Query Pin
Dave Kreskowiak25-Jul-13 1:17
mveDave Kreskowiak25-Jul-13 1:17 
GeneralRe: Paramerterized OleDB Query Pin
gautamn199025-Jul-13 19:28
gautamn199025-Jul-13 19:28 
GeneralRe: Paramerterized OleDB Query Pin
Dave Kreskowiak26-Jul-13 2:52
mveDave Kreskowiak26-Jul-13 2:52 
GeneralRe: Paramerterized OleDB Query Pin
gautamn199028-Jul-13 19:03
gautamn199028-Jul-13 19:03 
AnswerRe: Paramerterized OleDB Query Pin
PIEBALDconsult25-Jul-13 14:19
mvePIEBALDconsult25-Jul-13 14:19 
GeneralRe: Paramerterized OleDB Query Pin
gautamn199025-Jul-13 19:45
gautamn199025-Jul-13 19:45 
GeneralRe: Paramerterized OleDB Query Pin
PIEBALDconsult26-Jul-13 7:58
mvePIEBALDconsult26-Jul-13 7:58 
QuestionDataGridview ComboBox Filter Pin
Awais Jan24-Jul-13 23:44
Awais Jan24-Jul-13 23:44 
Questionproblem with datagridview in windows application Pin
Arun kumar Gautam24-Jul-13 20:59
Arun kumar Gautam24-Jul-13 20:59 
QuestionRe: problem with datagridview in windows application Pin
Eddy Vluggen25-Jul-13 7:12
professionalEddy Vluggen25-Jul-13 7:12 
AnswerRe: problem with datagridview in windows application Pin
Arun kumar Gautam25-Jul-13 19:32
Arun kumar Gautam25-Jul-13 19:32 
AnswerRe: problem with datagridview in windows application Pin
Eddy Vluggen26-Jul-13 8:05
professionalEddy Vluggen26-Jul-13 8:05 
Questionsingle sogn on using active directory Pin
ketan italiya24-Jul-13 20:42
ketan italiya24-Jul-13 20:42 
AnswerRe: single sogn on using active directory Pin
Eddy Vluggen25-Jul-13 7:08
professionalEddy Vluggen25-Jul-13 7:08 
GeneralRe: single sogn on using active directory Pin
ketan italiya25-Jul-13 22:48
ketan italiya25-Jul-13 22:48 
GeneralRe: single sogn on using active directory Pin
Eddy Vluggen26-Jul-13 23:11
professionalEddy Vluggen26-Jul-13 23:11 
GeneralRe: single sogn on using active directory Pin
mrcbitting30-Jul-13 3:58
mrcbitting30-Jul-13 3:58 

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.