473,395 Members | 1,668 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Cannot bind char column to textbox

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
Jun 5 '07 #1
4 1971
Matt,

Is there any chance you have a mismatched middle tier to your database? Are
you sure you got all the sprocs changed?

One thing that would help in troubleshooting is if you could get a trace.
Go to the web.config and set TraceLevel to 4. Using the debug output
viewer and capture the trace output while reproing the problem and that will
spell out exactly what is going on.

Hope this helps,
Steve
"Matt Fondoble" <mfondobleATsizewiseDOTnetwrote in message
news:eO**************@TK2MSFTNGP03.phx.gbl...
>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

Jun 5 '07 #2
On Jun 5, 5:28 pm, "Matt Fondoble" <mfondobleATsizewiseDOTnetwrote:
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()

Jun 5 '07 #3
Matt,

I had the same yesterday, it was an orphaned binding.

Can you search your application with the fieldname that is used?

Cor

"Matt Fondoble" <mfondobleATsizewiseDOTnetschreef in bericht
news:eO**************@TK2MSFTNGP03.phx.gbl...
>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

Jun 6 '07 #4
Guys,

Thanks for the help. It ended up that I had failed to change the DB type in
another table from bigint to char. I had changed all of the SP's which is
why I was getting the error.

Thanks again. Now......how do I put all of my hair back in.

Matt Fondoble

"Matt Fondoble" <mfondobleATsizewiseDOTnetwrote in message
news:eO**************@TK2MSFTNGP03.phx.gbl...
>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

Jun 6 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Jodi | last post by:
Hi, I am trying to put a textbox in a template column both for displaying and editing. When I add the following line to the HTML code <%#DataBinder.Eval(Container.DataItem, "comments")%>...
4
by: Arturo Cuebas | last post by:
The program below contains a compile error. Following the program you will find the typical fix then my idea for a library that facilitates a more elegant fix. #include <boost\bind.hpp> using...
0
by: VbScripter | last post by:
In the code below, I have an editItemTemplate that will have to have a long list of ip's bound to it. The problem is that the lisbox is not seen by asp.net until after the datalist containing it...
3
by: MrMike | last post by:
Hi. I have a dataset on my webform which I successfully fill by calling a Sub that occurs after the Page_Load. My question is - I have a textbox control which I need to populate with the contents...
3
by: Lori Markle via .NET 247 | last post by:
(Type your message here) Hi, I'm having a problem with binding a textbox to a dataset. Cananybody figure out what's going on here? I simply want to update a record. Type in a permit number...
1
by: Michael via .NET 247 | last post by:
I have a datagrid with the columns defined in the aspx <columns> <asp:TemplateColumn HeaderText="Hours" ItemStyle-Width="1%"ItemStyle-HorizontalAlign="Center"> <ItemTemplate> <asp:TextBox...
0
by: teclioness | last post by:
Hi, I am using gridview for the user to update rows. In a row, there sre two columns, which need to be updated. When the gridview is to be shown, the row should show the values from database....
1
by: mike11d11 | last post by:
Can anyone Tell me why this code doesnt let me bind a Textbox field to the Account# column in my SQL table. It says "Cannot bind to the property or column ACCOUNT# on the DataSource. Parameter...
0
by: dave | last post by:
I am using sqldatasource and the gridview for editing a number of admin tables. I woud like to use column index number in the following statement <asp:TextBox ID="TextBox1" runat="server"...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.