Re: Cannot bind char column to textbox
- From: Looch <lucianoj2005@xxxxxxxxx>
- Date: Tue, 05 Jun 2007 14:41:05 -0700
On Jun 5, 5:28 pm, "Matt Fondoble" <mfondobleATsizewiseDOTnet> wrote:
I have a form with multiple textboxes, checkboxes and comboboxes bound to a
dataset in VB 2003. I was forced to change the database structure of a
field from bigint to char. After changing the database and all associated
stored procedures, my textbox bound to the newly changed field will not
populate and I receive the error below.
Unhandled Exception: System.Data.SqlClient.SqlException: Error converting
data type varchar to bigint
I have narrowed down the problem to the line of code where is set the text
property of the textbox. If I comment out this line, every other control
populates normally. I've also tried putting the database value into the
text property of a label and displaying it in a message box. Those both
work as expected. I've also tried setting the value to a variable and then
assigning the variable to the textbox.text property to no avail.
Any ideas would be appreciated.
Matt Fondoble
I have a similar app and had to get a little creative, may not be best
practices but it works well.
If you are just reading the data you should be able to add .ToString()
in the line that adds the db value to the text box like:
Me.txtTicketNumber.Text = reader("TicketNumberActual").ToString()
.
- References:
- Cannot bind char column to textbox
- From: Matt Fondoble
- Cannot bind char column to textbox
- Prev by Date: Re: Anyone know what this means? (Updating DataGridView)
- Next by Date: Re: UNION in SQL for DataAdapter gives me error when configuring
- Previous by thread: Re: Cannot bind char column to textbox
- Next by thread: Re: Cannot bind char column to textbox
- Index(es):
Relevant Pages
|