euel
Member
Hi guys! I'm kinda new with Visual Basic.
So I created this simple function to get all DATES in a field(Date) from mysql database.
then add it into my Combo Box
What im trying to do is convert the date (ex. 2012-11-23 to November 23).
But I'm getting an error with this line--> dateStart = Format(rows.GetDateTime(1).ToString("m")) saying that "Conversion from string "m" to type 'Integer' is not valid."
Before i made it to a function (when it was just one whole code in my form) it works perfectly..
I'm guessing its the data type of the row or the value that i returned, but i can't seem to find some references on how to do this visual basic way..
I'm a php programmer so its easy to it in php..
Any ideas? Help really appreciated!
Thanks!!!
So I created this simple function to get all DATES in a field(Date) from mysql database.
VB.NET:
Public Function tblSelect(ByVal selectString As String)
Dim myCmd As MySqlCommand
Dim myReader As MySqlDataReader
SQLConnection.Open()
myCmd = New MySqlCommand(selectString, SQLConnection)
myReader = myCmd.ExecuteReader()
Return myReader
SQLConnection.Close()
End Function
then add it into my Combo Box
VB.NET:
Dim participationRows As Object
Dim dateStart As Date
rows = tblSelect(selectString)
While (rows.Read())
dateStart = Format(rows.GetDateTime(1).ToString("m"))
cmbProjects.Items.Add(dateStart)
End While
rows.close()
What im trying to do is convert the date (ex. 2012-11-23 to November 23).
But I'm getting an error with this line--> dateStart = Format(rows.GetDateTime(1).ToString("m")) saying that "Conversion from string "m" to type 'Integer' is not valid."
Before i made it to a function (when it was just one whole code in my form) it works perfectly..
I'm guessing its the data type of the row or the value that i returned, but i can't seem to find some references on how to do this visual basic way..
I'm a php programmer so its easy to it in php..
Any ideas? Help really appreciated!
Thanks!!!