Results 1 to 3 of 3

Thread: getting the value from mysql

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Feb 2007
    Posts
    153

    getting the value from mysql

    hi to all,
    i was created one table in my sql the query is


    create table test(name varchar(50),age int,mailid varchar(50),phoneno varchar(50),remainder date)

    i was inserting the record by using the following query

    insert into test values('ssss',22,'[email protected]','54654765',3/23/2007)


    when i am reading the value from mysql in c#.Net, it will give the error Unable to convert MySql date to System.datetime

    the coding i have used is

    clsGlobalFields.mysqlcon = new MySqlConnection("server=" + servername + ";port=" + strport + ";database=" + databasename + ";uid=" + struname + ";pwd=" + strpwd + ";");
    mysqlcon.Open();
    mysqlcmd = new MySqlCommand(select date from test , clsGlobalFields.mysqlcon);

    mysqlreader=mysqlcmd.ExecuteReader();
    while(mysqlreader.Read())
    {
    messagebox.show(mysqlreader[0].toString());
    }



    anybody know plz help me to solve the problem

    thank u
    With thanks and Regards
    MMary

  2. #2
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: getting the value from mysql

    Please use the [code] or [highlight=c#] tags to post C# code in future, thanks.

    Where have you declared mysqlreader?

  3. #3
    Fanatic Member
    Join Date
    Jan 2005
    Location
    Cebu
    Posts
    607

    Re: getting the value from mysql

    There's no date column on your test table. If you want to select the date use "select now()"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width