Visual Basic .NET Forums  
Click here to advertise with us

Go Back   Visual Basic .NET Forums > Database > MySQL

MySQL Discussion on using MySQL as a backend for VB.NET apps

VB.NET Forums Newsletter Signup:
Email address:


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-07-2010, 8:31 AM
VB.NET Forum Newbie
.NET Framework: .NET 3.5
 
Join Date: Feb 2010
Posts: 4
Reputation: 0
sigster is on a distinguished programming path ahead
Default problem Format Date in Textbox from Mysql database

Hi hope someone can help me with this Please

I am using VB.NET and MySql

What I have been try is write Date and read Date to and from the database
I having problem formatting Date to the Textbox



This is how I read from the database and I can not format the date nothing happend
I get = 12.2.2010 00:00:00
try to format to = 12.02.2010

Code:
Txt_date.Text = (Format(rs.Fields("date").Value.ToString, "dd-mm-yyyy"))

This is how I write to the database
Code:
Txt_date.Text = DateTime.Now.ToShortDateString
              rs.Fields("date").Value = Txt_date.Text
Regards
Sigster
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-07-2010, 2:28 PM
VB.NET Forum Newbie
.NET Framework: .NET 3.5
 
Join Date: Feb 2010
Location: Thessaloniki
Posts: 10
Reputation: 4
icarus1 is on a distinguished programming path ahead
Default

I am using a DataGridView to show data from a data base. Each data has a date stamp. The user is sellects the date in a DateTimePicker object.

The date format in the data base is dd/MM/yyyy.

So I am doing this:

Dim day As String = Me.DateTimePiCker.Value.ToString("dd/MM/yyyy")

Dim sqlCommand As String = "SELECT * FROM matrix WHERE Date = """ & day & """ "

I hope this helps
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-07-2010, 2:32 PM
VB.NET Forum Newbie
.NET Framework: .NET 3.5
 
Join Date: Feb 2010
Posts: 4
Reputation: 0
sigster is on a distinguished programming path ahead
Default

Hi

It works fine if I use DateTimePiCker but not if I am try to use textbox
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





All times are GMT -4. The time now is 4:11 AM.

Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2


For advertising opportunities click here.