C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
Today
    Last 7 Days more...






    Resources » Code Snippets » ADO.NET »

    MySql and Ado.Net


    Posted Date: 26 Oct 2008    Resource Type: Code Snippets    Category: ADO.NET
    Author: taresh sudaMember Level: Silver    
    Rating: 1 out of 5Points: 10



    The following code snippet provides an idea to use MySql in ADO.Net

    {code}
    //for record in databases..
    MySqlConnection objconnection = new MySqlConnection("server=localhost;uid=root;password=maa;database=taresh");
    MySqlCommand objcommand = new MySqlCommand("", objconnection);
    objcommand.Parameters.Add("?itemCode",MySqlDbType.VarChar,15);
    objcommand.Parameters.Add("?itemName", MySqlDbType.VarString, 25);
    objcommand.Parameters.Add("?Rate", MySqlDbType.Double, 10);
    objcommand.Parameters.Add("?supp", MySqlDbType.VarString, 25);
    objcommand.CommandText = "insert into item values(?itemCode,?itemName,?Rate,?supp)";
    objcommand.Parameters["?itemCode"].Value=txtItemCode.Text.ToUpper();
    objcommand.Parameters["?itemName"].Value = txtItemName.Text.ToUpper();
    objcommand.Parameters["?Rate"].Value = txtItemRate.Text.ToUpper();
    objcommand.Parameters["?supp"].Value = txtSuppliersName.Text.ToUpper();
    //objcommand.CommandText = command;
    try
    {
    objcommand.ExecuteNonQuery();
    MessageBox.Show("Record Added");

    }
    catch (MySqlException ex)
    {
    MessageBox.Show(ex.Message);
    }


    Following points should be kept in mind :
    1. MySql Database Server must be installed [refer to site:http://dev.mysql.com/downloads/index.html]
    2. Should be configured.
    3. For more details refer to article published in : http://www.15seconds.com/issue/050210.htm




    Responses


    No responses found. Be the first to respond and make money from revenue sharing program.

    Feedbacks      
    Popular Tags   What are tags ?   Search Tags  
    Sign In to add tags.
    MySql Database Server  .  ADO And MYSQL  .  

    Post Feedback


    This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
    You must Sign In to post a response.
    Next Resource: Get Multiple records using DataTable.Select.
    Previous Resource: Concatenate the column with our format
    Return to Discussion Resource Index
    Post New Resource
    Category: ADO.NET


    Post resources and earn money!
     
    Related Resources



    dotNet Slackers

    About Us    Contact Us    Privacy Policy    Terms Of Use