metalaxeman
New member
- Joined
- Apr 18, 2010
- Messages
- 2
- Programming Experience
- Beginner
I'm trying to add a record to a table, getting the data from textboxes i've set up on the form. This is what i'm using atm:
but I'm getting this error:
ArguementException was unhandeled
VChar
on the line
SQLCom.Parameters.Add("@p1", SqlDbType.VarChar, 4).Value = tbMemberID.Text
Any ideas what's wrong??
Dim SQLCon As New SqlServerCe.SqlCeConnection
Dim SQLCom As New SqlServerCe.SqlCeCommand
SQLCon = New SqlServerCe.SqlCeConnection("Data Source = BK.sdf")
SQLCom.CommandText = "INSERT INTO [Current Rentals](MemberID,DVDID,DaysonRent,DateRented,DueDate,TotalPrice,Overdue,DaysOverdue,OverduePrice) VALUES (@p1,@p2,@p3,@p4,@p5,@p6,@p7,@p8,@p9)"
SQLCom.Parameters.Add("@p1", SqlDbType.VarChar, 4).Value = tbMemberID.Text
SQLCom.Parameters.Add("@p2", SqlDbType.VarChar, 6).Value = tbDVDID.Text
SQLCom.Parameters.Add("@p3", SqlDbType.Int, 9).Value = cbDays.SelectedItem
SQLCom.Parameters.Add("@p4", SqlDbType.DateTime, 8).Value = DateTime.Today.Date
SQLCom.Parameters.Add("@p5", SqlDbType.DateTime, 8).Value = DateTime.Today.AddDays(Int(cbDays.SelectedItem))
SQLCom.Parameters.Add("@p6", SqlDbType.Money, 19).Value = tbPrice.Text
SQLCom.Parameters.Add("@p7", SqlDbType.VarChar, 1).Value = "N"
SQLCom.Parameters.Add("@p8", SqlDbType.Int, 9).Value = DBNull.Value
SQLCom.Parameters.Add("@p9", SqlDbType.Money, 19).Value = DBNull.Value
SQLCon.Open()
SQLCom.ExecuteNonQuery()
SQLCon.Close()
but I'm getting this error:
ArguementException was unhandeled
VChar
on the line
SQLCom.Parameters.Add("@p1", SqlDbType.VarChar, 4).Value = tbMemberID.Text
Any ideas what's wrong??