By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,760 Members | 1,135 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,760 IT Pros & Developers. It's quick & easy.

Strange Data Parameter Problem

P: n/a
Bob
Hello:

Ok I have two code samples here. This one doesn't work at all.

The error is
Input string was not in a correct format.
daClientsMain.SelectCommand.Parameters("ClientID") .Value
= txtFind.Text
daClientsMain.SelectCommand.Parameters("OfficeFile Num").Value
= txtFind.Text
daClientsMain.SelectCommand.Parameters("MortPolNum ").Value
= txtFind.Text
daClientsMain.SelectCommand.Parameters("FeePolNum" ).Value
= txtFind.Text

Dim MyCheck As Boolean
MyCheck = IsDate(txtFind.Text)
If MyCheck = True Then
daClientsMain.SelectCommand.Parameters("ClosingDat e").Value
= CDate(txtFind.Text)
Else
daClientsMain.SelectCommand.Parameters("ClosingDat e").Value
= CDate(#2/2/1902#)
End If

daClientsMain.SelectCommand.Parameters("BuyerSearc hCode").Value
= txtFind.Text
daClientsMain.SelectCommand.Parameters("SellerSear chCode").Value
= txtFind.Text
daClientsMain.SelectCommand.Parameters("PropertyAd dress").Value
= txtFind.Text
Me.daClientsMain.Fill(objdsClients)
But this one does work as long as I type in a valide date into txtFind.Text:

daClientsMain.SelectCommand.Parameters("ClientID") .Value
= txtFind.Text
daClientsMain.SelectCommand.Parameters("OfficeFile Num").Value
= txtFind.Text
daClientsMain.SelectCommand.Parameters("MortPolNum ").Value
= txtFind.Text
daClientsMain.SelectCommand.Parameters("FeePolNum" ).Value
= txtFind.Text
daClientsMain.SelectCommand.Parameters("ClosingDat e").Value
= CDate(txtFind.Text)
daClientsMain.SelectCommand.Parameters("BuyerSearc hCode").Value
= txtFind.Text
daClientsMain.SelectCommand.Parameters("SellerSear chCode").Value
= txtFind.Text
daClientsMain.SelectCommand.Parameters("PropertyAd dress").Value
= txtFind.Text
Me.daClientsMain.Fill(objdsClients)
I can type in any date format into it and it works ie 5/5/05 or 5/5/2005 or
05/05/05 or 05/05/2005 or May 5, 2005 all work in the second sample..
TIA

Bob
Nov 21 '05 #1
Share this Question
Share on Google+
2 Replies

P: n/a
Does it work if you change the
CDate(#2/2/1902#)
to
CDate("2/2/1902")
?

On Wed, 20 Jul 2005 21:18:43 GMT, "Bob" <no****@nospammers.com> wrote:
Hello:

Ok I have two code samples here. This one doesn't work at all.

The error is
Input string was not in a correct format.
daClientsMain.SelectCommand.Parameters("ClientID") .Value
= txtFind.Text
daClientsMain.SelectCommand.Parameters("OfficeFile Num").Value
= txtFind.Text
daClientsMain.SelectCommand.Parameters("MortPolNum ").Value
= txtFind.Text
daClientsMain.SelectCommand.Parameters("FeePolNum" ).Value
= txtFind.Text

Dim MyCheck As Boolean
MyCheck = IsDate(txtFind.Text)
If MyCheck = True Then
daClientsMain.SelectCommand.Parameters("ClosingDat e").Value
= CDate(txtFind.Text)
Else
daClientsMain.SelectCommand.Parameters("ClosingDat e").Value
= CDate(#2/2/1902#)
End If

daClientsMain.SelectCommand.Parameters("BuyerSearc hCode").Value
= txtFind.Text
daClientsMain.SelectCommand.Parameters("SellerSear chCode").Value
= txtFind.Text
daClientsMain.SelectCommand.Parameters("PropertyAd dress").Value
= txtFind.Text
Me.daClientsMain.Fill(objdsClients)
But this one does work as long as I type in a valide date into txtFind.Text:

daClientsMain.SelectCommand.Parameters("ClientID") .Value
= txtFind.Text
daClientsMain.SelectCommand.Parameters("OfficeFile Num").Value
= txtFind.Text
daClientsMain.SelectCommand.Parameters("MortPolNum ").Value
= txtFind.Text
daClientsMain.SelectCommand.Parameters("FeePolNum" ).Value
= txtFind.Text
daClientsMain.SelectCommand.Parameters("ClosingDat e").Value
= CDate(txtFind.Text)
daClientsMain.SelectCommand.Parameters("BuyerSearc hCode").Value
= txtFind.Text
daClientsMain.SelectCommand.Parameters("SellerSear chCode").Value
= txtFind.Text
daClientsMain.SelectCommand.Parameters("PropertyAd dress").Value
= txtFind.Text
Me.daClientsMain.Fill(objdsClients)
I can type in any date format into it and it works ie 5/5/05 or 5/5/2005 or
05/05/05 or 05/05/2005 or May 5, 2005 all work in the second sample..
TIA

Bob


Nov 21 '05 #2

P: n/a
Bob
no but it works if I change

daClientsMain.SelectCommand.Parameters("ClientID") .Value = txtFind.Text

to

daClientsMain.SelectCommand.Parameters("ClientID") .Value = 0

but not if I change it to

daClientsMain.SelectCommand.Parameters("ClientID") .Value =
CInt(txtFind.Text)

I see I need to write some err handling

Bob
Nov 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.