MySqlParameter is a class in .NET MySQL connector.
Questions tagged [mysql-parameter]
19 questions
                    
                    21
                    
            votes
                
                9 answers
            
        Add List to a mysql parameter 
        I have this question about the MySqlParameter from the .NET connector.
I have this query:
SELECT * FROM table WHERE id IN (@parameter)
And the MySqlParameter is:
intArray = new…
         
    
    
        Phoenix_uy
        
- 3,173
- 9
- 53
- 100
                    9
                    
            votes
                
                8 answers
            
        C# and MySQL .NET Connector - Any way of preventing SQL Injection attacks in a generic class?
My idea is to create some generic classes for Insert/Update/Select via a C# (3.5) Winforms app talking with a MySQL database via MySQL .NET Connector 6.2.2.
For example:
public void Insert(string strSQL)
{
   if (this.OpenConnection() == true)
   {
…
         
    
    
        John M
        
- 14,338
- 29
- 91
- 143
                    6
                    
            votes
                
                1 answer
            
        C# MySqlParameter problem
(int) faultsGroup  is 0 or 1 but i always get this error: Column 'FaultGroup' cannot be null
Does anyone tell me why? Syntax looks ok.
MySqlCommand cmdAdd = new MySqlCommand("INSERT INTO Faults (" +
        "  FaultGroup, Text, Date, IP" +
       …
         
    
    
        senzacionale
        
- 20,448
- 67
- 204
- 316
                    5
                    
            votes
                
                3 answers
            
        Why does MySqlParameter Add parameter as 0 convert to null
I'm adding a parameter to be called with a MySQL stored procedure like
List MyParams = new List();    
MyParams.Add(new MySqlParameter("MyId", 0));
But for some reason when I look at MyParams, MyId value when…  
         
    
    
        neildt
        
- 5,101
- 10
- 56
- 107
                    4
                    
            votes
                
                1 answer
            
        C# with MySql and Unicode characters
My problem is when using C# and MySQL database to save some records by sending parameters.
Although i have already set the charset as Utf-8 and i can see the unicode characters correctly, the problem i get when trying to insert unicode characters is…
         
    
    
        Kypros
        
- 2,997
- 5
- 21
- 27
                    4
                    
            votes
                
                2 answers
            
        Can i use a parameter multiple times in the same query?
i was wondering, can a parameter be used more then once in the same query, like this : 
MySqlParameter oPar0 = new MySqlParameter("e164", MySqlDbType.String);
oPar0.Value = user.E164;
string sSQL0 = "Delete from callmone.call where (caller=?e164 or…
         
    
    
        Terry
        
- 5,132
- 4
- 33
- 66
                    2
                    
            votes
                
                1 answer
            
        MySqlParameter as TableName
I want to use MySqlParameter to pass tableName into query (to prevent slq injections)
MySqlCommand cmd = new MySqlCommand("select * from @table"), cn)
cmd.Parameters.AddWithValue("@table",TableName);
But this is not working. How can I pass…
         
    
    
        Stecya
        
- 22,896
- 10
- 72
- 102
                    2
                    
            votes
                
                3 answers
            
        How do I conditionally set a column to its default value with MySqlParameter?
I have a table in a MySql database that stores user accounts. One of the columns, expires, stores an expiration date but defaults to NULL. I need to be able to remove an expiration date and set it back to the default value.
Currently, all of my CRUD…
         
    
    
        Adam Lassek
        
- 35,156
- 14
- 91
- 107
                    2
                    
            votes
                
                1 answer
            
        Difference between adding MySql Parameters with Add() and AddWithValue()
According to MySql in this document C.7.9.6. Changes in MySQL Connector/NET 5.0.5 (07 March 2007):
Added MySqlParameterCollection.AddWithValue and marked the Add(name, value) method as obsolete. 
I've been using .Add up until recently and…
         
    
    
        JYelton
        
- 35,664
- 27
- 132
- 191
                    1
                    
            vote
                
                2 answers
            
        sqlcommand c# method with sql paramather
I have this method, which I have in the base class that helps me to select anything from the children classes and also to reduce code repetition. The problem is when I call it I get an error which is a NullReferenceException (and when I look it up I…
         
    
    
        user3560798
        
- 31
- 4
                    1
                    
            vote
                
                1 answer
            
        Excepion with MysqlCommand and "SET @q:" variable C#?
i have this code:
using (MySql.Data.MySqlClient.MySqlConnection cn = new   
MySql.Data.MySqlClient.MySqlConnection(
            Properties.Settings.Default.CONNNConnectionString))
        {
            cn.Open();
           …
        
    
                    1
                    
            vote
                
                1 answer
            
        mySQL :syntax using in C#
I am using in C# MYsql .I have query that works if I run on MySql Workbench ,but in C# it does not return any value also does not give ant error too.There is only one different using on Mysql I use before table name  databaseName.tableName , but in…
         
    
    
        Ercan
        
- 2,699
- 10
- 53
- 60
                    0
                    
            votes
                
                1 answer
            
        C# MySqlParameter Wildcard Search
I am trying to have a function that can search for an item (in this case, a motherboard) in a database when given parameters, but I want to be able to get all motherboards if no parameters are given.
The query is: 
SELECT * FROM motherboard WHERE…
         
    
    
        Madeline
        
- 645
- 1
- 9
- 19
                    0
                    
            votes
                
                0 answers
            
        Connection between R-Shiny and SQL
I'm a beginner and practicing R and SQL connection. I connected R shiny with a classicmodels database and got an 'unused argument' error in the parameter settings. I've looked up various references and done a lot of experimenting but I still can't…
         
    
    
        user18
        
- 1
- 1
                    0
                    
            votes
                
                1 answer
            
        MySqlParameter with float value of 0.0
I constructed a MySqlParameter with MySqlParameter tmp1 = new MySqlParameter("?tmp1", 0.0); and when executing the corresponding insert query received the error message that the respective column cannot be null.
When investigating that parameter in…
         
    
    
        Bernhard Hiller
        
- 2,163
- 2
- 18
- 33
