Posts Topics Forums Images
Search videos from message boards Videos Search messages from microblogs Microblogs Search messages from imdb.com Imdb Search messages from yuku.com Yuku Search messages from lefora.com (free forums) Lefora
My account: Login | Sign Up
Loading... 

Thread: Error converting data type varchar to float

Started 1 month, 1 week ago by tracmonali
Hello, I get this error "Error converting data type varchar to float at System.Data.SqlClient.SqlConnection" when I am running an Insert stmt. This is the code: Protected Sub BUCreatePIR_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BUCreatePIR.Click Dim InsertSQL As String = "" InsertSQL = "Insert into Main_table(Sold_To_#, Sold_To_Name, Sold...
Site: Forums - ASP.NET Forums  Forums - ASP.NET Forums - site profile
Forum: Data Access and ObjectDataSource Control  Data Access and ObjectDataSource Control - forum profile
Total authors: 4 authors
Total thread posts: 9 posts
Thread activity: no new posts during last week
Domain info for: asp.net

Other posts in this thread:

ScottR27 replied 1 month, 1 week ago
On a side note, you code is begging for a SQL injection... You should really be using SqlParameters for this see http://msdn.microsoft.com/en-us/library/system.dat a.sqlclient.sqlparameter.aspx . To answer your question, what are your data types for the Table? One of your data types is not matching, can you post the rest of the Stack? Hope this helps, --Scott...

leena.d.patil replied 1 month, 1 week ago
Hi, While inserting data in database we have ensure that data type of all the columns and values that we are inserting should match. Please check whether you are passing values with proper data type or not.

tracmonali replied 1 month, 1 week ago
Leena, My insert code works perfect when I run it exclusively. One of the fields SoldTo#, when inserted by user, populates other 4 textboxes. But with the TBCustNoSoldTo_TextChanged event, it also triggers the click button event; which I do not wish to happen. The user must fill rest of the fields and then explicitly click the button. It is then I wish to run the click button event and ...

tusharrs replied 1 month, 1 week ago
hello, plz check the no of fields and the values in the query i think it is not matching it is causing an error regards, tusharrs

tusharrs replied 1 month, 1 week ago
it is 9 and 10 regards, tusharrs

tracmonali replied 1 month, 1 week ago
Thanks Tusharrs, I checked the no of parameters. PLease read my post written to Leena. I found solution, a work around. Thanks for everybody's responses.

tusharrs replied 1 month, 1 week ago
hello, you mean this query runs Insert into Main_table (Sold_To_#, Sold_To_Name, Sold_To_Address, Sold_To_City, Sold_To_State, Sold_To_Zip, Bolt_#, Product_Category, Issue_or_Complaint) Select '' as Sold_To_#, '' as 'Sold_To_Name', '' as Sold_To_Address, '' as Sold_To_City, '' as Sold_To_State, " as Sold_To_Zip,...

tracmonali replied 1 month, 1 week ago
This runs fine Tushar. Protected Sub BUCreatePIR_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BUCreatePIR.Click Dim InsertSQL As String = "" InsertSQL = "Insert into Main_table(Sold_To_#, Sold_To_Name, Sold_To_Address, Sold_To_City, Sold_To_State, Sold_To_Zip,Bolt_#, Product_Category, Issue_or_Complaint) Select " InsertSQL += "'" & ...

 

Top contributing authors

Name
Posts
tracmonali
4
user's latest post:
Error converting data type...
Published (2009-11-11 13:09:49)
This runs fine Tushar. Protected Sub BUCreatePIR_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BUCreatePIR.Click                 Dim InsertSQL As String = ""         InsertSQL = "Insert into...
tusharrs
3
user's latest post:
Error converting data type...
Published (2009-11-11 12:51:49)
hello, you mean this query runs Insert  into  Main_table           (Sold_To_#, Sold_To_Name, Sold_To_Address,            Sold_To_City, Sold_To_State, Sold_To_Zip,          ...
ScottR27
1
user's latest post:
Error converting data type...
Published (2009-11-11 11:32:49)
On a side note, you code is begging for a SQL injection... You should really be using SqlParameters for this see http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlparameter.aspx .  To answer your question, what are your data types for the Table? One of your data types is not matching, can you post the rest of the Stack? Hope this helps, --Scott
leena.d.patil
1
user's latest post:
Error converting data type...
Published (2009-11-11 11:39:49)
Hi, While inserting data in database we have ensure that data type of all the columns and values that we are inserting should match. Please check whether you are passing values with proper data type or not.  

Related threads on "Forums - ASP.NET Forums":

Related threads on other sites:

Thread profile page for "Error converting data type varchar to float" on http://www.asp.net. This report page is a snippet summary view from a single thread "Error converting data type varchar to float", located on the Message Board at http://www.asp.net. This thread profile page shows the thread statistics for: Total Authors, Total Thread Posts, and Thread Activity