-
Jul 7th, 2017, 09:16 AM
#1
Thread Starter
Lively Member
[RESOLVED] How To Combine String From DTPicker and Textbox?
I need to combine date from a DTPicker, and numbers from a textbox (lets say text1). How do i do this? I tried text2= DTPicker + Text1, but Vb6 add text1 to DTPicker mathematically instead of combining the string. Sorry if this is too basic. Thanks in advance
-
Jul 7th, 2017, 09:31 AM
#2
Re: How To Combine String From DTPicker and Textbox?
Use & not + when concatenating strings. Does that help?
-
Jul 7th, 2017, 09:37 AM
#3
Thread Starter
Lively Member
Re: How To Combine String From DTPicker and Textbox?
Originally Posted by LaVolpe
Use & not + when concatenating strings. Does that help?
I will try it
-
Jul 7th, 2017, 09:39 AM
#4
Thread Starter
Lively Member
Re: How To Combine String From DTPicker and Textbox?
Originally Posted by LaVolpe
Use & not + when concatenating strings. Does that help?
i tried it, and it works. thanks a lot
-
Jul 7th, 2017, 09:07 PM
#5
Thread Starter
Lively Member
Re: [RESOLVED] How To Combine String From DTPicker and Textbox?
Originally Posted by LaVolpe
Use & not + when concatenating strings. Does that help?
Hey man, I got another problem.
The date in dtpicker's date wont save (insert) to a database field that i designed for it. So when i clicked save, the "tglabsen" field is empty. I am using MySql, and i set tglabsen's type as DATE. Is it has anything to do as to why the date generated by DTPicker wont saved to it? I changed the fields type in mysql into varchar, and it works. The format of the date is separated by "/" (like 07/07/2017). Is it has anything to do with the date format?
Also, the combining string method works fine. I combined the primary key for the employee, which is 011, to the date from DTPicker. I got 07/07/2017011, and its stored in a textbox. But when I tried to save it to the mysql table, the program only stores the date part, and not the primary key. How can this happen?
Here is the code that i use :
Sub simpanbrg()
simpan = "insert into absen (kd_absen, NIP, tglabsen) values('" & tkode & "', '" & cnip.Text & "', '" & dtpicker & "')"
KON.Execute simpan
End sub
-
Jul 7th, 2017, 09:08 PM
#6
Thread Starter
Lively Member
Re: How To Combine String From DTPicker and Textbox?
Originally Posted by LaVolpe
Use & not + when concatenating strings. Does that help?
Hey man, I got another problem.
The date in dtpicker's date wont save (insert) to a database field that i designed for it. So when i clicked save, the "tglabsen" field is empty. I am using MySql, and i set tglabsen's type as DATE. Is it has anything to do as to why the date generated by DTPicker wont saved to it? I changed the fields type in mysql into varchar, and it works. The format of the date is separated by "/" (like 07/07/2017). Is it has anything to do with the date format?
Also, the combining string method works fine. I combined the primary key for the employee, which is 011, to the date from DTPicker. I got 07/07/2017011, and its stored in a textbox. But when I tried to save it to the mysql table, the program only stores the date part, and not the primary key. How can this happen?
Here is the code that i use :
Sub simpanbrg()
simpan = "insert into absen (kd_absen, NIP, tglabsen) values('" & tkode & "', '" & cnip.Text & "', '" & dtpicker & "')"
KON.Execute simpan
End sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|