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

C#

 
GeneralRe: How can I access to an item in a solution folder ? Pin
Mohammad Dayyan21-Sep-08 3:35
Mohammad Dayyan21-Sep-08 3:35 
GeneralRe: How can I access to an item in a solution folder ? Pin
Caio Kinzel Filho21-Sep-08 7:20
Caio Kinzel Filho21-Sep-08 7:20 
Questionsending messages to gtalk Pin
Mogaambo20-Sep-08 11:14
Mogaambo20-Sep-08 11:14 
GeneralAttempt to bump a post. Pin
Pete O'Hanlon20-Sep-08 11:29
mvePete O'Hanlon20-Sep-08 11:29 
GeneralRe: Attempt to bump a post. Pin
Paul Conrad20-Sep-08 11:59
professionalPaul Conrad20-Sep-08 11:59 
QuestionADO CommandText with parameter values. Pin
AndrusM20-Sep-08 10:57
AndrusM20-Sep-08 10:57 
AnswerRe: ADO CommandText with parameter values. Pin
Giorgi Dalakishvili20-Sep-08 11:34
mentorGiorgi Dalakishvili20-Sep-08 11:34 
AnswerRe: ADO CommandText with parameter values. Pin
snifozao27-Oct-10 13:49
snifozao27-Oct-10 13:49 
There is a tricky way to do it.

ADO not seems to help providing the SQL query with the proper values prior running.

Here my code snippet that will do the job and may be easily converted any other .NET variant. It's a simple example but may be a start.

Some basic checks were done regarding quotes and backslashes but for sure this code need some care before use on production enviroment.

Note: You will need to change the type SQLiteCommand/SQLiteParameter to the one that matches your ADO methods set.


public static string getQueryFromCommand(SQLiteCommand cmd)  
{  
    string CommandTxt = cmd.CommandText;  
  
    foreach (SQLiteParameter parms in cmd.Parameters)  
    {  
        string val = String.Empty;  
        if (parms.DbType.Equals(DbType.String) || parms.DbType.Equals(DbType.DateTime))  
            val = "'" + Convert.ToString(parms.Value).Replace(@"\", @"\\").Replace("'", @"\'") + "'";  
        if (parms.DbType.Equals(DbType.Int16) || parms.DbType.Equals(DbType.Int32) || parms.DbType.Equals(DbType.Int64) || parms.DbType.Equals(DbType.Decimal) || parms.DbType.Equals(DbType.Double))  
            val = Convert.ToString(parms.Value);  
        string paramname = "@" + parms.ParameterName;  
        CommandTxt = CommandTxt.Replace(paramname, val);  
    }  
    return (CommandTxt);  
}  




Bruno Ratnieks
CTO Sniffer.net
bruno@sniffer.net
QuestionDetect MouseNotMove event Pin
baranils20-Sep-08 10:43
baranils20-Sep-08 10:43 
AnswerRe: Detect MouseNotMove event Pin
Mark Salsbery20-Sep-08 11:00
Mark Salsbery20-Sep-08 11:00 
AnswerRe: Detect MouseNotMove event Pin
Anthony Mushrow20-Sep-08 11:01
professionalAnthony Mushrow20-Sep-08 11:01 
GeneralRe: Detect MouseNotMove event Pin
baranils20-Sep-08 11:22
baranils20-Sep-08 11:22 
GeneralRe: Detect MouseNotMove event Pin
Anthony Mushrow20-Sep-08 13:55
professionalAnthony Mushrow20-Sep-08 13:55 
GeneralRe: Detect MouseNotMove event Pin
baranils21-Sep-08 6:49
baranils21-Sep-08 6:49 
QuestionRe: Detect MouseNotMove event Pin
Mark Salsbery21-Sep-08 7:08
Mark Salsbery21-Sep-08 7:08 
AnswerRe: Detect MouseNotMove event Pin
baranils21-Sep-08 7:20
baranils21-Sep-08 7:20 
GeneralRe: Detect MouseNotMove event Pin
Mark Salsbery21-Sep-08 7:39
Mark Salsbery21-Sep-08 7:39 
QuestionRe: Detect MouseNotMove event Pin
baranils21-Sep-08 7:26
baranils21-Sep-08 7:26 
AnswerRe: Detect MouseNotMove event Pin
Mark Salsbery21-Sep-08 7:46
Mark Salsbery21-Sep-08 7:46 
GeneralRe: Detect MouseNotMove event Pin
baranils21-Sep-08 10:42
baranils21-Sep-08 10:42 
GeneralRe: Detect MouseNotMove event Pin
Mark Salsbery21-Sep-08 14:31
Mark Salsbery21-Sep-08 14:31 
GeneralRe: Detect MouseNotMove event Pin
baranils21-Sep-08 10:54
baranils21-Sep-08 10:54 
GeneralRe: Detect MouseNotMove event Pin
Mark Salsbery21-Sep-08 14:37
Mark Salsbery21-Sep-08 14:37 
GeneralRe: Detect MouseNotMove event Pin
baranils21-Sep-08 19:38
baranils21-Sep-08 19:38 
QuestionDetecting thumb drive insertion and suppressing Autorun. Pin
ihaxxu20-Sep-08 9:05
ihaxxu20-Sep-08 9:05 

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.