Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7505145
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T21:48:35+00:00 2026-05-29T21:48:35+00:00

Ok So Basically I have made MySQL table on PhpMyAdmin. It’s on local host,

  • 0

Ok So Basically I have made MySQL table on PhpMyAdmin. It’s on local host, username root and no password.

I’m working on a Windows Application based on c# on visual express 2008. I have the following code for a button to save/load data from the MySQL(I have followed some links/tuts to get to this point, but dunno how this can theoritically connect to the MySQL @ phpmyadmin, I mean Dont I need a file to download from PhpmyAdmin database and reference or add it as a plugin to the script or something? Tottaly lost here..):

        String connString = "SERVER = localhost; DATABASE = request; User ID = root; ID =; UserName =; Date =; Type =; Rules =;"; 
        MySqlConnection mcon = new MySqlConnection(connString);
        String command = "SELECT * FROM requesttcw";
        MySqlCommand cmd = new MySqlCommand(command, mcon);
        MySqlDataReader reader;

        try
        {
            mcon.Open();
            cmd.ExecuteNonQuery();
            reader = cmd.ExecuteReader();
            cmd.CommandType = System.Data.CommandType.Text;
            while (reader.Read() != false)
            {
                Console.WriteLine(reader["ID"]);
                Console.WriteLine(reader["ClanName"]);
                Console.WriteLine(reader["Date"]);
                Console.WriteLine(reader["Type"]);
                Console.WriteLine(reader["Rules"]);

            }

            Console.ReadLine(); 

        }
        catch (Exception)
        {
            MessageBox.Show("ERROR: There was an error trying to connect to the DB!");
            return;
        }
        cmd.CommandText = "INSERT INTO requesttcw (ClanName, Date, Type, Rules) VALUES ('" + textBox1.Text + "', '" + textBox2.Text + "', '" + textBox3.Text + "', '" + richTextBox1.Text + "' LIMIT 1)";

        try
        {
            cmd.ExecuteNonQuery();
            MessageBox.Show("You're Request Has Been Posted!");
        }
        catch (Exception ex)
        {
            string message = ("ERROR: There was an error submitting your form!" + ex + "");
            DialogResult result = MessageBox.Show(message, "ERROR", MessageBoxButtons.RetryCancel, MessageBoxIcon.Question);

            switch (result)
            {
                case DialogResult.Retry:
                    Application.Restart();
                    break;
                case DialogResult.Cancel:
                    this.Close();
                    break;
            }
        }

When I run it, enter my data, and click the button, It gives me this error on line(MySqlConnection mcon = new MySqlConnection(connString);
*
Keyword not supported.
Parameter name: id
*

Please tell me how to fully connect this to the MySQL.. I have also downloaded the MySQL Connector and referenced the mysql.data.dll file. So that part is done too…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T21:48:36+00:00Added an answer on May 29, 2026 at 9:48 pm

    Try the following connection string:

    string connString = "Server=localhost;Database=request;Uid=root;Pwd=;";
    

    Also try cleaning your code and ensure that you are properly disposing IDispoable resources such as SQL connections and commands by wrapping them in using statements. Also make sure that you are using prepared statements or your code is vulnerable to SQL injection attacks and your database could be ruined very quickly (in a blink of an eye):

    string connString = "Server=localhost;Database=request;Uid=root;Pwd=;";
    
    using (MySqlConnection mcon = new MySqlConnection(connString))
    using (MySqlCommand cmd = mcon.CreateCommand())
    {
        mcon.Open();
        cmd.CommandText = "SELECT * FROM requesttcw";
        using (MySqlDataReader reader = cmd.ExecuteReader())
        {
            while (reader.Read())
            {
                Console.WriteLine(reader["ID"]);
                Console.WriteLine(reader["ClanName"]);
                Console.WriteLine(reader["Date"]);
                Console.WriteLine(reader["Type"]);
                Console.WriteLine(reader["Rules"]);
            }
        }
    }
    
    using (MySqlConnection mcon = new MySqlConnection(connString))
    using (MySqlCommand cmd = mcon.CreateCommand())
    {
        mcon.Open();
        cmd.CommandText = "INSERT INTO requesttcw (ClanName, Date, Type, Rules) VALUES (@ClanName, @Date, @Type, @Rules)";
        cmd.Parameters.AddWithValue("@ClanName", textBox1.Text);
    
        // Warning if the Date column in your database is of type DateTime
        // you need to parse the value first, like this:
        // cmd.Parameters.AddWithValue("@Date", Date.Parse(textBox2.Text));
        cmd.Parameters.AddWithValue("@Date", textBox2.Text);
        cmd.Parameters.AddWithValue("@Type", textBox3.Text);
        cmd.Parameters.AddWithValue("@Rules", richTextBox1.Text);
    
        cmd.ExecuteNonQuery();
    }
    

    As far as exception handling is concerned, I have omitted it in my example but you could obviously wrap the using statements in try/catch blocks.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

basically i have a site which made by php and mysql i wanna to
I have made a custom formwizard and incorporated it into my admin interface. Basically
I have a vertical menu in my system which is basically made of HTML
I have made a css3 based light box, basically it applies css3 rules to
I have made CAlayer that contains an image. What i basically want to do
I have made the following webpage for generating interactive todo lists: http://robert-kent.com/todo/todo.php Basically, the
basically i have $(msgbox .content).html(FOO); but i have made a plugin and need to
I have made one custom user control (search text box), which basically consists of
I want to introduce a cache policy in my app. Basically I have made
I am new to ZF.i have made a function that basically make a Form

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.