输入的字符串格式不正确.无法存储在“客户ID列"中.预期的类型是Int32. [英] Input string was not in a correct format.Couldn't store in CustomerID Column. Expected type is Int32.

查看:83
本文介绍了输入的字符串格式不正确.无法存储在“客户ID列"中.预期的类型是Int32.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以帮助我吗?每当我单击按钮提交详细信息时,我都会遇到此问题.

Can anybody help me. I encounter this problem everytime i click the button to submit the details.

Protected Sub ButtonViewCustomerdetails_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ButtonViewCustomerdetails.Click
        MultiView1.SetActiveView(ViewSummary)

        Dim NewCustomer As New DataSet1TableAdapters.Customer3TableAdapter
        NewCustomer.InsertCustomer3(Session("guid"), Me.TextBoxFirstName.Text, Me.TextBoxLastName.Text, Me.TextBoxAddress1.Text, Me.TextBoxAddress2.Text, Me.TextBoxCity.Text, Me.TextBoxPostalcode.Text, Me.TextBoxCountry.Text, Me.TextBoxTelephone.Text, Me.TextBoxMobile.Text, Me.TextBoxEmail.Text)

        Dim Customerconfirm As New DataSet1TableAdapters.Customer3TableAdapter
        Dim Confirmcustomer As New DataSet1.Customer3DataTable
        Confirmcustomer = Customerconfirm.GetDataByCustomer31(Session("guid"))

        Dim ID As String = Confirmcustomer.Rows(0)("CustomerID")

        LabelCustomerID.Text = ID
    End Sub

推荐答案

我认为您需要将Session("guid")编写为Session("guid").tostring()(如果它是varchar数据类型),否则如果它是int,则将其转换为int
您需要将会话转换为字符串,其他文本框也要采用正确的格式,例如字符串以及您已在数据库中分配给各个列的其他格式
i think you need to write Session("guid") as Session("guid").tostring() if it is a varchar datatype else if it is int then convert it to int
you need to convert the session to string and other text boxes also to be in proper format like string and others which you have assigned in database to respective columns


这篇关于输入的字符串格式不正确.无法存储在“客户ID列"中.预期的类型是Int32.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆