Click here to Skip to main content
15,889,335 members
Home / Discussions / Visual Basic
   

Visual Basic

 
Questionsql statement Pin
magedhv18-Jul-07 22:39
magedhv18-Jul-07 22:39 
AnswerRe: sql statement Pin
Naji El Kotob18-Jul-07 22:58
Naji El Kotob18-Jul-07 22:58 
AnswerRe: sql statement Pin
magedhv18-Jul-07 23:03
magedhv18-Jul-07 23:03 
GeneralRe: sql statement Pin
Colin Angus Mackay18-Jul-07 23:36
Colin Angus Mackay18-Jul-07 23:36 
GeneralRe: sql statement Pin
Colin Angus Mackay18-Jul-07 23:35
Colin Angus Mackay18-Jul-07 23:35 
QuestionCode errors [modified] Pin
ASPnoob18-Jul-07 20:40
ASPnoob18-Jul-07 20:40 
AnswerRe: Code errors Pin
kubben19-Jul-07 1:52
kubben19-Jul-07 1:52 
AnswerRe: Code errors Pin
MidwestLimey20-Jul-07 4:34
professionalMidwestLimey20-Jul-07 4:34 
I see several problems with this code snippet:

"select logo from" + " pub_info where pub_id='" + id + "'"
Why are you concatenating "select logo from" and " pub_info where pub_id=" ??
This is a better approach:
string.Format("select logo from pub_info where pub_id='{0}'", id)
Only one string is declared and no concatenation takes place.

CByte() attempts a conversion from something to a Byte, not an array of bytes. If the scaler execution is returning an array of bytes then with option strict off you should be able to just assign it. If you want to program decently and switch option strict on then the following would assign it:
Dim _buf As Byte() = DirectCast(_cmd.ExecuteScaler(), Byte())
If you get an invalid type / cast exception then the result of the query is not a byte array.

Finally I see a Finally clause in use to close the connection, which is great. But why is there an empty Catch ? It's not needed.

Hope this helps.




I'm largely language agnostic

After a while they all bug me D'Oh! | :doh:


GeneralRe: Code errors Pin
Paul Conrad20-Jul-07 7:05
professionalPaul Conrad20-Jul-07 7:05 
GeneralRe: Code errors Pin
MidwestLimey20-Jul-07 7:11
professionalMidwestLimey20-Jul-07 7:11 
Questionwindow deployment Pin
Sonia Gupta18-Jul-07 19:33
Sonia Gupta18-Jul-07 19:33 
AnswerRe: window deployment Pin
originSH18-Jul-07 22:25
originSH18-Jul-07 22:25 
AnswerRe: window deployment Pin
manni_n19-Jul-07 5:30
manni_n19-Jul-07 5:30 
QuestionDateTimePicker Pin
nitin318-Jul-07 19:12
nitin318-Jul-07 19:12 
AnswerRe: DateTimePicker Pin
CPallini18-Jul-07 20:43
mveCPallini18-Jul-07 20:43 
GeneralRe: DateTimePicker Pin
originSH18-Jul-07 22:29
originSH18-Jul-07 22:29 
GeneralRe: DateTimePicker Pin
CPallini18-Jul-07 22:36
mveCPallini18-Jul-07 22:36 
GeneralRe: DateTimePicker Pin
CPallini18-Jul-07 22:42
mveCPallini18-Jul-07 22:42 
GeneralRe: DateTimePicker Pin
nitin318-Jul-07 23:10
nitin318-Jul-07 23:10 
QuestionCapture image from camera (webcam) ??? Pin
memcaliber18-Jul-07 10:13
memcaliber18-Jul-07 10:13 
AnswerRe: Capture image from camera (webcam) ??? Pin
Dave Kreskowiak18-Jul-07 10:21
mveDave Kreskowiak18-Jul-07 10:21 
AnswerRe: Capture image from camera (webcam) ??? Pin
Naji El Kotob18-Jul-07 11:18
Naji El Kotob18-Jul-07 11:18 
Questionremove invalid character from txt file Pin
jds120718-Jul-07 7:21
jds120718-Jul-07 7:21 
AnswerRe: remove invalid character from txt file Pin
Dave Kreskowiak18-Jul-07 7:31
mveDave Kreskowiak18-Jul-07 7:31 
QuestionDatagrid data Pin
Cory Kimble18-Jul-07 6:49
Cory Kimble18-Jul-07 6:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.