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.
Author |
Topic |
vk18
Posting Yak Master
146 Posts |
Posted - 2006-11-22 : 15:14:09
|
Hi Friends,I am trying to add below two fields(description,ckext) in a list box. I am getting error.Can some one help me what i am doing wrong.Thxsql = "SELECT *,CAST(description) + ' - ' + ckext as ListBox FROM tblsub" |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2006-11-22 : 15:16:06
|
What are you CASTing description as? Is that not already text?sql = "SELECT description + ' - ' + ckext as ListBox FROM tblsub"Peter LarssonHelsingborg, Sweden |
 |
|
vk18
Posting Yak Master
146 Posts |
Posted - 2006-11-22 : 15:30:28
|
quote: Originally posted by vk18 Hi Friends,I am trying to add below two fields(description,ckext) in a list box. I am getting error.Can some one help me what i am doing wrong.Thxsql = "SELECT *,CAST(description) + ' - ' + ckext as ListBox FROM tblsub"
Hi Description is text and ckext is integer. I tried this but still doesn work. getting the error "object reference not set to instance of object"Thx |
 |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2006-11-22 : 15:32:42
|
sql = "SELECT description + ' - ' + CONVERT(varchar, ckext) as ListBox FROM tblsub"Peter LarssonHelsingborg, Sweden |
 |
|
vk18
Posting Yak Master
146 Posts |
Posted - 2006-11-22 : 15:52:44
|
quote: Originally posted by Peso sql = "SELECT description + ' - ' + CONVERT(varchar, ckext) as ListBox FROM tblsub"Peter LarssonHelsingborg, Sweden
Thanks, It works now |
 |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-11-22 : 20:16:57
|
quote: Originally posted by Peso sql = "SELECT description + ' - ' + CONVERT(varchar, ckext) as ListBox FROM tblsub"Peter LarssonHelsingborg, Sweden
Note that if you dont specify the size, by default it is 30MadhivananFailing to plan is Planning to fail |
 |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2006-11-23 : 00:45:17
|
I think INTEGER is smaller than 30 digits...Peter LarssonHelsingborg, Sweden |
 |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-11-23 : 03:41:15
|
quote: Originally posted by Peso I think INTEGER is smaller than 30 digits...Peter LarssonHelsingborg, Sweden
Yes it is. It is just for precaution MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|
|