Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Values in textboxes

Author  Topic 

risa.86
Starting Member

3 Posts

Posted - 2007-06-17 : 07:15:35
How to combine the values entered in two separate boxes and store them in one column of a table..

For eg: one textbox is time i.e 10:30 and the other is am or pm...this should be stored together as 10:30am..

Anyone has a solution?

`RG`

dinakar
Master Smack Fu Yak Hacker

2507 Posts

Posted - 2007-06-17 : 12:00:28
concatenate the values from your front end.

Dinakar Nethi
************************
Life is short. Enjoy it.
************************
http://weblogs.sqlteam.com/dinakar/
Go to Top of Page

Vinnie881
Master Smack Fu Yak Hacker

1231 Posts

Posted - 2007-06-17 : 12:03:22
I'm not sure where to begin on this.

1. Are you talking about a .net application?
2. What is your table structure in sql
3. What type of datatype are you looking to use?

I am going to assume the following

1. It's a VB.NET App
2. Your table is TBL1(TBL1ID int ,TBL1Date datetime)
3. Your TBl1Date is a DateTime datatype.
4. Your tb that holds the date is TBDATE, the Time is TBTIME, AM/PM TBAMPM

dim x as string = me.tbl1date.text & " " & me.tbtime.text & " " me.tbampm.text

' Then use the value of x to update your table column.



If your saying you have two columns in a table that need this then the process again would be to first figure out what datatype the columns are. If varchar/nvarchar and they are going to a datetime column.

I am assuming Your table is TBL1(TBL1ID int,TBL1Date datetime,coldate varchar(20),coltime varchar(20),colAMPM varchar(20))




Update TBl1
set tb1Date = convert(Datetime, COLDATE + ' ' + ColTIME + ' ' + COLAMPM,102)



Next time for a exact answer please be far more specific with your questions so people don't need to guess what you are asking. This will allow your question to get answered faster and properly.
Go to Top of Page
   

- Advertisement -