Click here to Skip to main content
16,008,942 members
Home / Discussions / C#
   

C#

 
General[Message Deleted] Pin
gubba30-Nov-07 15:15
gubba30-Nov-07 15:15 
GeneralRe: setting timer Pin
Paul Conrad30-Nov-07 15:19
professionalPaul Conrad30-Nov-07 15:19 
QuestionChanging MDB Tool Generated Dataset Source Pin
Reanalyse30-Nov-07 12:55
Reanalyse30-Nov-07 12:55 
QuestionQuestion about Base64 code example Pin
CCMint30-Nov-07 12:50
CCMint30-Nov-07 12:50 
QuestionLooks like database connection is giving an error that the object is null Pin
T4AMD30-Nov-07 11:04
T4AMD30-Nov-07 11:04 
AnswerRe: Looks like database connection is giving an error that the object is null Pin
Ian Shlasko30-Nov-07 11:12
Ian Shlasko30-Nov-07 11:12 
GeneralRe: Looks like database connection is giving an error that the object is null Pin
T4AMD30-Nov-07 11:39
T4AMD30-Nov-07 11:39 
GeneralRe: Looks like database connection is giving an error that the object is null Pin
Pete O'Hanlon30-Nov-07 11:50
mvePete O'Hanlon30-Nov-07 11:50 
The order you associate the connection with your command makes no difference whatsoever. Association wise, it doesn't matter whether or not you open the connection and then create the command or create the command then open the connection. Although you should always attempt to open the connection just before you execute your command (preferably in the statement before) because you want the connection to be open as short a time as possible.

What I would suggest you do is break the split command apart from the ExecuteScalar part. In other words, read the value into a string - and then, if the string isn't null attempt the split. Combining operations like this can lead you into a lot of bother.

One more thing - try using a parameterised query rather than a concatenated query. It reduces the risk of you falling prey to a SQL Injection attack. Clickety[^]

Deja View - the feeling that you've seen this post before.

My blog | My articles


AnswerRe: Looks like database connection is giving an error that the object is null Pin
Pete O'Hanlon30-Nov-07 11:35
mvePete O'Hanlon30-Nov-07 11:35 
QuestionNeed c# programmer Pin
AndreasSweden30-Nov-07 10:19
AndreasSweden30-Nov-07 10:19 
AnswerRe: Need c# programmer Pin
Paul Conrad30-Nov-07 10:56
professionalPaul Conrad30-Nov-07 10:56 
QuestionHow can I clear a buffer? Pin
daavena30-Nov-07 9:37
daavena30-Nov-07 9:37 
AnswerRe: How can I clear a buffer? Pin
Dan Neely30-Nov-07 9:45
Dan Neely30-Nov-07 9:45 
GeneralRe: How can I clear a buffer? Pin
daavena30-Nov-07 10:10
daavena30-Nov-07 10:10 
GeneralRe: How can I clear a buffer? Pin
Ian Shlasko30-Nov-07 11:08
Ian Shlasko30-Nov-07 11:08 
GeneralRe: How can I clear a buffer? Pin
daavena1-Dec-07 1:40
daavena1-Dec-07 1:40 
AnswerRe: How can I clear a buffer? Pin
Anthony Mushrow30-Nov-07 10:00
professionalAnthony Mushrow30-Nov-07 10:00 
AnswerRe: How can I clear a buffer? Pin
ovrgarriga30-Nov-07 10:49
ovrgarriga30-Nov-07 10:49 
GeneralRe: How can I clear a buffer? Pin
daavena30-Nov-07 12:40
daavena30-Nov-07 12:40 
GeneralRe: How can I clear a buffer? Pin
ovrgarriga1-Dec-07 1:16
ovrgarriga1-Dec-07 1:16 
GeneralRe: How can I clear a buffer? Pin
daavena1-Dec-07 1:49
daavena1-Dec-07 1:49 
JokeRe: How can I clear a buffer? Pin
PIEBALDconsult30-Nov-07 13:06
mvePIEBALDconsult30-Nov-07 13:06 
GeneralRe: How can I clear a buffer? Pin
Luc Pattyn30-Nov-07 13:41
sitebuilderLuc Pattyn30-Nov-07 13:41 
GeneralRe: How can I clear a buffer? Pin
PIEBALDconsult1-Dec-07 4:00
mvePIEBALDconsult1-Dec-07 4:00 
AnswerRe: How can I clear a buffer? Pin
Zoltan Balazs1-Dec-07 12:02
Zoltan Balazs1-Dec-07 12:02 

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.