Home > DeveloperSection > Forums > how get date in c# dateTimePicker control
Kenny Tangnde

Total Post:68

Points:476
Posted on    October-14-2011 9:06 PM

 C# C# 
Ratings:


 12 Reply(s)
 6345  View(s)
Rate this:

Hi All,

    I encountered some problems, See details below:

how get date in c# dateTimePicker control,i need date only.such as:2011-10-15 (yyyy-month-day).

Can not immediately update the data in treeView1_NodeMouseClick event.

see code below:

private void treeView1_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
        {
            dataGridView1.DataSource = "";  
         try
            {
              
                string AccessAddress = System.IO.Path.GetFullPath("PSRecord.mdb");
                //con = new OleDbConnection(@"provider=microsoft.ace.oledb.12.0;persist securityInfo=false;data source=" + AccessAddress);
                con = new OleDbConnection(@"provider=microsoft.jet.oledb.4.0;data source=" + AccessAddress);
                con.Open();
                cmd = new OleDbCommand("select * from Record  where driver='" + treeView1.SelectedNode.Text.ToString() + "'", con);
                ds = new DataSet();
                adapter = new OleDbDataAdapter(cmd);
                adapter.Fill(ds);
                dataGridView1.DataSource = ds.Tables[0];

            }
            catch (Exception ex)
            {

                MessageBox.Show(ex.ToString());
            }
            finally
            {
                con.Close();
            }
        }

i need help now,Thanks!



Uttam Misra

Total Post:124

Points:888
Posted on    October-14-2011 11:21 PM


Modified On Oct-14-2011 11:52:25 PM

Kenny Tangnde

Total Post:68

Points:476
Posted on    October-15-2011 12:10 AM

Hi Uttam Misra,

  You help me to solve the first problem, the problem is now the second left.

thanks for your help.


Kenny Tangnde

Total Post:68

Points:476
Posted on    October-15-2011 12:19 AM

I have a problem,client run my program error occurred,Error content is:The 'microsoft.jet.oledb.4.0' provider is not registered on the local machine.

Code is as follows:

private void frmMain_Load(object sender, EventArgs e)
        {
            string AccessAddress=System.IO.Path.GetFullPath("PSRecord.mdb");
            //con = new OleDbConnection(@"provider=microsoft.ace.oledb.12.0;persist securityInfo=false;data source=" + AccessAddress);
            con = new OleDbConnection(@"provider=microsoft.jet.oledb.4.0;data source=" + AccessAddress);
            con.Open();
            cmd = new OleDbCommand("select drivername from driver", con);
            reader = cmd.ExecuteReader();
            TreeNode parent = treeView1.Nodes.Add("DriverName");
            TreeNode child;
            parent.ForeColor = Color.Red;
            while (reader.Read())
            {
               //comboBox1.Items.Add(reader["DriverName"]);
               child = parent.Nodes.Add(reader.GetValue(0).ToString());
               child.ForeColor = Color.Blue;
 
            }
            parent.ExpandAll();
            reader.Close();
            con.Close();


        }

 

thanks very much.


Uttam Misra

Total Post:124

Points:888
Posted on    October-15-2011 1:09 AM

are you working with 64bit system?

Kenny Tangnde

Total Post:68

Points:476
Posted on    October-15-2011 1:40 AM

client system is XP sp2

Uttam Misra

Total Post:124

Points:888
Posted on    October-15-2011 1:55 AM


Are you running your application on x64 or x86 version of Windows?

Modified On Oct-15-2011 01:56:31 AM

Kenny Tangnde

Total Post:68

Points:476
Posted on    October-15-2011 2:14 AM

Where to set?

Uttam Misra

Total Post:124

Points:888
Posted on    October-15-2011 2:27 AM

To resolve this issue open the project in Visual Studio :

1. From the solution explorer right-click your project then click Properties
2. Click the Build tab
3. Change Platform target from: Any CPU to x86
4. Re-build your solution


Kenny Tangnde

Total Post:68

Points:476
Posted on    October-15-2011 3:05 AM

x86 can run it in XP sp2 environment?

thanks!


John Smith

Total Post:101

Points:711
Posted on    October-15-2011 5:01 AM

you got it ...is it working now?

Modified On Oct-15-2011 05:02:23 AM

Alex R
Alex R

Total Post:40

Points:280
Posted on    October-15-2011 6:29 AM

Hi Aken H,

It is always a good habbit to ask someone if you get stuck some where, and I appretiate you do so to get your queries solved. But I have a suggestion for you so that you can get your answer more quickly.

Please do make sure that if you have more than one query always start a seperate thread for each problem so that each of your problem get noticed individually.

Hope, you got all your problems solved here and you will be following the the suggestions provided above in near future.

Thanks.


Kenny Tangnde

Total Post:68

Points:476
Posted on    October-16-2011 7:55 AM

Hi Haider M Rizvi,

Thank you for reminding me, i will correct.

 

Thanks.


Don't want to miss updates? Please click the below button!

Follow MindStick