Hi,
Im kinda new to this whole programming thing, but i am getting a little trouble in one area. The Problem is where you see "System.Data.SqlDbType.Int", i think this is due to the fact i have changed the code here to work for an access db rather than sql server - but SqlDbType isnt valid. but ive been searching the net all day with no luck. any help would be greatley appreciated.
Dim ConnectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0; Ole DB Services=-4; Data Source=" & Server.MapPath("~\db\digital.mdb")
Dim Conn As System.Data.IDbConnection = New System.Data.OleDb.OleDbConnection(ConnectionString)
Dim comm As System.Data.IDbCommand = New System.Data.OleDb.OleDbCommand("INSERT INTO [SC2_tbl] ([UserID], [ProductID], [ProductName], [ImageS], [Date], [Price], [Quantity]) VALUES (
@UserID,
@ProductID,
@ProductName,
@ImageS,
@Date,
@Price,
@Quantity)", Conn)
comm.Parameters.Add("
@UserID", System.Data.OleDb.NChar, 36)
Comm.Parameters("
@UserID"
.Value = Session("UserID") 'Set in Global.asax
Comm.Parameters.Add("
@ProductID", System.Data.SqlDbType.Int)
Comm.Parameters("
@ProductID"
.Value = ProductID
Comm.Parameters.Add("
@ProductName", System.Data.SqlDbType.VarChar, 50)
Comm.Parameters("
@ProductName"
.Value = ProductName
Comm.Parameters.Add("
@ImageS", System.Data.SqlDbType.VarChar, 50)
Comm.Parameters("
@ImageS"
.Value = ImageS
Comm.Parameters.Add("
@Date", System.Data.SqlDbType.SmallDateTime)
Comm.Parameters("
@Date"
.Value = SaleDate
Comm.Parameters.Add("
@Price", System.Data.SqlDbType.SmallMoney)
Comm.Parameters("
@Price"
.Value = Price
Comm.Parameters.Add("
@Quantity", System.Data.SqlDbType.Int)
Comm.Parameters("
@Quantity"
.Value = Quantity
Try
conn.Open()
Comm.ExecuteNonQuery()
Catch ex As Exception