P
Patrick Sullivan
I get this error (VB.Net 2003/SQL Server 2000)
-----
An unhandled exception of type 'System.InvalidCastException' occurred in
microsoft.visualbasic.dll
Additional information: Cast from string "compID" to type 'Integer' is not
valid.
-----
when this code executes at runtime "Row.appCompany =
CInt(cmbCompanies.ValueMember)"
I have tried using "val()" and "clng()" but those would not even compile.
Here is the setup:
---------
Dim con As New SqlConnection(ConnectionString)
appDataSet = New DataSet2
Dim adapter As SqlDataAdapter = New SqlDataAdapter("SELECT * FROM
Applications", con)
adapter.Fill(appDataSet, "Applications")
'Insert a new row into the typed dataset and populate it with
values.
Dim Row As DataSet2.ApplicationsRow
Row = appDataSet.Applications.NewApplicationsRow()
Row.appCompany = CInt(cmbCompanies.ValueMember)
Row.appPosition = CInt(cmbPosition.ValueMember)
Row.appDate = CDate("")
Row.appMethod = CInt(cmbMethod.ValueMember)
appDataSet.Applications.AddApplicationsRow(Row)
grpBoxDisable(True)
-----
An unhandled exception of type 'System.InvalidCastException' occurred in
microsoft.visualbasic.dll
Additional information: Cast from string "compID" to type 'Integer' is not
valid.
-----
when this code executes at runtime "Row.appCompany =
CInt(cmbCompanies.ValueMember)"
I have tried using "val()" and "clng()" but those would not even compile.
Here is the setup:
---------
Dim con As New SqlConnection(ConnectionString)
appDataSet = New DataSet2
Dim adapter As SqlDataAdapter = New SqlDataAdapter("SELECT * FROM
Applications", con)
adapter.Fill(appDataSet, "Applications")
'Insert a new row into the typed dataset and populate it with
values.
Dim Row As DataSet2.ApplicationsRow
Row = appDataSet.Applications.NewApplicationsRow()
Row.appCompany = CInt(cmbCompanies.ValueMember)
Row.appPosition = CInt(cmbPosition.ValueMember)
Row.appDate = CDate("")
Row.appMethod = CInt(cmbMethod.ValueMember)
appDataSet.Applications.AddApplicationsRow(Row)
grpBoxDisable(True)