sql string problem URGENT

blinx
10-13-2004, 09:36 PM
Hey, I have some problem here...
I test my string but it perform the error way
--------------------
Dim fstring As String

fstring = "exec sp_bfm_c"
MsgBox sqlstring & " " & "where cabang = '" & Combo2.Text & "' and week = '" & Combo4.Text & "' and year= '" & Combo5.Text & "' "

I need string like this : exec sp_test_c '10','20','2004'
but after I test it using msgbox it come lie this : exec sp_test_c '10 ','20','2004'

so the error : '10 ' <-- There is 1 space between 0 and ' and it create error for my stored procedure

How to solve this ?
Thx

blinx
10-13-2004, 09:37 PM
sory2 the sqlstring should be fstring....(mistype)

Help pls

blinx
10-13-2004, 09:44 PM
sory should be this way (ouch 2 times)

fstring = "exec sp_test_c"

MsgBox fstring & " " & "'" & (Combo2.Text) & "','" & (Combo4.Text) & "','" & Right(Combo5.Text, 2) & "'"

I need exec sp_test_c '10','20',2004' (dynamic from combo value)

Thx

webbone
10-13-2004, 10:33 PM
Hey, I have some problem here...
I test my string but it perform the error way
--------------------
Dim fstring As String

fstring = "exec sp_bfm_c"
MsgBox sqlstring & " " & "where cabang = '" & Combo2.Text & "' and week = '" & Combo4.Text & "' and year= '" & Combo5.Text & "' "

I need string like this : exec sp_test_c '10','20','2004'
but after I test it using msgbox it come lie this : exec sp_test_c '10 ','20','2004'

so the error : '10 ' <-- There is 1 space between 0 and ' and it create error for my stored procedure

How to solve this ?
Thx
I think what you are really asking is how to remove leading and/or trailing spaces? You can use Trim():


MsgBox fstring & " " & "'" & Trim$(Combo2.Text) & "','" & Trim$(Combo4.Text) & "','" & Right(Combo5.Text, 2) & "'"

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum