Re: Cannot bind char column to textbox

Tech-Archive recommends: Fix windows errors by optimizing your registry



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()

.



Relevant Pages

  • Re: Cannot bind char column to textbox
    ... field from bigint to char. ... After changing the database and all associated ... my textbox bound to the newly changed field will not ... Unhandled Exception: System.Data.SqlClient.SqlException: Error converting ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Linking SQL Server 2000 to Access - Bigint datatype
    ... I'm using Access 2003 to generate the database, ... I did try converting it to Access 2002-2003 format using the ... >> I'm currently trying to create an Access database that has links to SQL ... I've narrowed down the issue to the bigint datatype; ...
    (microsoft.public.access.externaldata)
  • Re: Linking SQL Server 2000 to Access - Bigint datatype
    ... I'm using Access 2003 to generate the database, ... I did try converting it to Access 2002-2003 format using the ... >> I'm currently trying to create an Access database that has links to SQL ... I've narrowed down the issue to the bigint datatype; ...
    (microsoft.public.sqlserver.odbc)
  • Re: Linking SQL Server 2000 to Access - Bigint datatype
    ... I'm using Access 2003 to generate the database, ... I did try converting it to Access 2002-2003 format using the ... >> I'm currently trying to create an Access database that has links to SQL ... I've narrowed down the issue to the bigint datatype; ...
    (microsoft.public.sqlserver.server)
  • Conversion from VT_DECIMAL TO VT_I8 failed
    ... I have a C++ program that creates records in a MSDE2000a database. ... stored procedure to create the record and it returns an identity value. ... returned value is stored in a BIGINT output parameter. ... The program runs fine on an English version of Windows XP. ...
    (microsoft.public.data.oledb)