universengo Member May 9, 2019 #1 Hello everyone! I am a newbje, Please help me. I use DButils to load access data (*.accdb file) to tableview. But my date is show on table view have time as 2018-05-29 00:00:00.000000 (see picture below) (although in may access date, i have set this field is short date) So I have a problem to load this date to my datepicker. Please help me how to get data from tableview to show on DatePicker when i click the table. Attachments date.jpg 155.1 KB · Views: 779
Hello everyone! I am a newbje, Please help me. I use DButils to load access data (*.accdb file) to tableview. But my date is show on table view have time as 2018-05-29 00:00:00.000000 (see picture below) (although in may access date, i have set this field is short date) So I have a problem to load this date to my datepicker. Please help me how to get data from tableview to show on DatePicker when i click the table.
Erel B4X founder Staff member Licensed User Longtime User May 9, 2019 #2 I guess that you are using DBUtils.ExecuteTableView. This method just takes the values as strings and adds them to the TableView. Which Jdbc driver are you using? Why are you using an access database instead of a proper database? Upvote 0
I guess that you are using DBUtils.ExecuteTableView. This method just takes the values as strings and adds them to the TableView. Which Jdbc driver are you using? Why are you using an access database instead of a proper database?
universengo Member May 9, 2019 #3 Erel said: I guess that you are using DBUtils.ExecuteTableView. This method just takes the values as strings and adds them to the TableView. Which Jdbc driver are you using? Why are you using an access database instead of a proper database? Click to expand... Thanks Erel. You are right. I use DBUtils.ExecuteTableView. I use these driver: ' SQLite driver #AdditionalJar: ucanaccess-4.0.4.jar #AdditionalJar: hsqldb.jar #AdditionalJar: jackcess-2.1.11.jar #AdditionalJar: commons-logging-1.1.3.jar #AdditionalJar: commons-lang-2.6.jar I use an access database instead of a proper database because I have this access file available and I would like to use these table in access file for using mail merge later (as default report). I don't know how data report. And the last, How to resolve my situation about use date from table and show on datepicker. Thanks. Upvote 0
Erel said: I guess that you are using DBUtils.ExecuteTableView. This method just takes the values as strings and adds them to the TableView. Which Jdbc driver are you using? Why are you using an access database instead of a proper database? Click to expand... Thanks Erel. You are right. I use DBUtils.ExecuteTableView. I use these driver: ' SQLite driver #AdditionalJar: ucanaccess-4.0.4.jar #AdditionalJar: hsqldb.jar #AdditionalJar: jackcess-2.1.11.jar #AdditionalJar: commons-logging-1.1.3.jar #AdditionalJar: commons-lang-2.6.jar I use an access database instead of a proper database because I have this access file available and I would like to use these table in access file for using mail merge later (as default report). I don't know how data report. And the last, How to resolve my situation about use date from table and show on datepicker. Thanks.
Erel B4X founder Staff member Licensed User Longtime User May 10, 2019 #4 You will need to get the string from the database and parse it. Code: Copy Dim dt As String = rs.GetString(...) dt = dt.Substring2(0, dt.IndexOf(" ")) Upvote 0
You will need to get the string from the database and parse it. Code: Copy Dim dt As String = rs.GetString(...) dt = dt.Substring2(0, dt.IndexOf(" "))
universengo Member May 14, 2019 #5 Erel said: You will need to get the string from the database and parse it. Code: Copy Dim dt As String = rs.GetString(...) dt = dt.Substring2(0, dt.IndexOf(" ")) Click to expand... Thanks Erel. I use this code for sqldate Sub in DBUtils Code Module as below: Code: Copy Public Sub DateSQL(txtDate As String, tgian As String) Dim CurrentFormat As String=DateTime.DateFormat DateTime.DateFormat="yyyy-MM-dd HH:mm:ss" Dim mysqlDate As String=DateTime.Date(tgian) DateTime.DateFormat=CurrentFormat txtDate=mysqlDate End Sub then I call this sub as below: Code: Copy Dim t As String DBUtils.DateSQL(t,Value) Log(t) But t have got to get data of DateSQL So log (t) is blank. Help me how to show t as mysqlDate Thanks. Upvote 0
Erel said: You will need to get the string from the database and parse it. Code: Copy Dim dt As String = rs.GetString(...) dt = dt.Substring2(0, dt.IndexOf(" ")) Click to expand... Thanks Erel. I use this code for sqldate Sub in DBUtils Code Module as below: Code: Copy Public Sub DateSQL(txtDate As String, tgian As String) Dim CurrentFormat As String=DateTime.DateFormat DateTime.DateFormat="yyyy-MM-dd HH:mm:ss" Dim mysqlDate As String=DateTime.Date(tgian) DateTime.DateFormat=CurrentFormat txtDate=mysqlDate End Sub then I call this sub as below: Code: Copy Dim t As String DBUtils.DateSQL(t,Value) Log(t) But t have got to get data of DateSQL So log (t) is blank. Help me how to show t as mysqlDate Thanks.
DonManfred Expert Licensed User Longtime User May 14, 2019 #6 Code: Copy Public Sub DateSQL(tgian As String) as String Dim CurrentFormat As String=DateTime.DateFormat DateTime.DateFormat="yyyy-MM-dd HH:mm:ss" Dim mysqlDate As String=DateTime.Date(tgian) DateTime.DateFormat=CurrentFormat return mysqlDate End Sub Code: Copy Dim t As String = DBUtils.DateSQL(Value) Log(t) I strongly suggest to learn the B4X Syntax and how the codeflow is! Upvote 0
Code: Copy Public Sub DateSQL(tgian As String) as String Dim CurrentFormat As String=DateTime.DateFormat DateTime.DateFormat="yyyy-MM-dd HH:mm:ss" Dim mysqlDate As String=DateTime.Date(tgian) DateTime.DateFormat=CurrentFormat return mysqlDate End Sub Code: Copy Dim t As String = DBUtils.DateSQL(Value) Log(t) I strongly suggest to learn the B4X Syntax and how the codeflow is!
universengo Member May 14, 2019 #7 DonManfred said: Code: Copy Public Sub DateSQL(tgian As String) as String Dim CurrentFormat As String=DateTime.DateFormat DateTime.DateFormat="yyyy-MM-dd HH:mm:ss" Dim mysqlDate As String=DateTime.Date(tgian) DateTime.DateFormat=CurrentFormat return mysqlDate End Sub Code: Copy Dim t As String = DBUtils.DateSQL(Value) Log(t) I strongly suggest to learn the B4X Syntax and how the codeflow is! Click to expand... Thanks DonManfred. It was SOLVED. Upvote 0
DonManfred said: Code: Copy Public Sub DateSQL(tgian As String) as String Dim CurrentFormat As String=DateTime.DateFormat DateTime.DateFormat="yyyy-MM-dd HH:mm:ss" Dim mysqlDate As String=DateTime.Date(tgian) DateTime.DateFormat=CurrentFormat return mysqlDate End Sub Code: Copy Dim t As String = DBUtils.DateSQL(Value) Log(t) I strongly suggest to learn the B4X Syntax and how the codeflow is! Click to expand... Thanks DonManfred. It was SOLVED.