Hi all,
I have problem with my VB.net code. here is my code :
oSQL = "Insert Into db_PurchDet Values(@pd1,@pd2,@pd3,@pd4,@pd5,@pd6,@pd7,@pd8,@pd9,@pd10)"
oCommand = New SqlClient.SqlCommand(oSQL, oConn)
oCommand.Parameters.Add(New SqlClient.SqlParameter("@pd1", SqlDbType.VarChar, 13, ParameterDirection.Input, False, 0, 0, _
oData.Tables("tblPurchaseDetails").Columns("pd1").ToString, DataRowVersion.Current, "pd1"))
oCommand.Parameters.Add(New SqlClient.SqlParameter("@pd2", SqlDbType.VarChar, 15, ParameterDirection.Input, False, 0, 0, _
oData.Tables("tblPurchaseDetails").Columns("pd2").ToString, DataRowVersion.Current, "pd2"))
oCommand.Parameters.Add(New SqlClient.SqlParameter("@pd3", SqlDbType.VarChar, 50, ParameterDirection.Input, False, 0, 0, _
oData.Tables("tblPurchaseDetails").Columns("pd3").ToString, DataRowVersion.Current, "pd3"))
oCommand.Parameters.Add(New SqlClient.SqlParameter("@pd4", SqlDbType.VarChar, 3, ParameterDirection.Input, False, 0, 0, _
oData.Tables("tblPurchaseDetails").Columns("pd3").ToString, DataRowVersion.Current, "pd3"))
oCommand.Parameters.Add(New SqlClient.SqlParameter("@pd5", SqlDbType.Int, 4, ParameterDirection.Input, False, 0, 0, _
oData.Tables("tblPurchaseDetails").Columns("pd5").ToString, DataRowVersion.Current, "pd5"))
oCommand.Parameters.Add(New SqlClient.SqlParameter("@pd6", SqlDbType.Int, 4, ParameterDirection.Input, False, 0, 0, _
oData.Tables("tblPurchaseDetails").Columns("pd6").ToString, DataRowVersion.Current, "pd6"))
oCommand.Parameters.Add(New SqlClient.SqlParameter("@pd7", SqlDbType.Money, 9, ParameterDirection.Input, False, 0, 0, _
oData.Tables("tblPurchaseDetails").Columns("pd7").ToString, DataRowVersion.Current, "pd7"))
oCommand.Parameters.Add(New SqlClient.SqlParameter("@pd8", SqlDbType.Money, 9, ParameterDirection.Input, False, 0, 0, _
oData.Tables("tblPurchaseDetails").Columns("pd8").ToString, DataRowVersion.Current, "pd8"))
oCommand.Parameters.Add(New SqlClient.SqlParameter("@pd9", SqlDbType.VarChar, 2, ParameterDirection.Input, False, 0, 0, _
oData.Tables("tblPurchaseDetails").Columns("pd9").ToString, DataRowVersion.Current, "pd9"))
oCommand.Parameters.Add(New SqlClient.SqlParameter("@pd10", SqlDbType.DateTime, 8, ParameterDirection.Input, False, 0, 0, _
oData.Tables("tblPurchaseDetails").Columns("pd10").ToString, DataRowVersion.Current, "pd10"))
oAdapter.InsertCommand = oCommand
oAdapter.Update(oData, "tblPurchaseDetails")
But, error message "Invalid object Name 'db_PurchDet'" always shown.
Can you help me....??????
I have problem with my VB.net code. here is my code :
oSQL = "Insert Into db_PurchDet Values(@pd1,@pd2,@pd3,@pd4,@pd5,@pd6,@pd7,@pd8,@pd9,@pd10)"
oCommand = New SqlClient.SqlCommand(oSQL, oConn)
oCommand.Parameters.Add(New SqlClient.SqlParameter("@pd1", SqlDbType.VarChar, 13, ParameterDirection.Input, False, 0, 0, _
oData.Tables("tblPurchaseDetails").Columns("pd1").ToString, DataRowVersion.Current, "pd1"))
oCommand.Parameters.Add(New SqlClient.SqlParameter("@pd2", SqlDbType.VarChar, 15, ParameterDirection.Input, False, 0, 0, _
oData.Tables("tblPurchaseDetails").Columns("pd2").ToString, DataRowVersion.Current, "pd2"))
oCommand.Parameters.Add(New SqlClient.SqlParameter("@pd3", SqlDbType.VarChar, 50, ParameterDirection.Input, False, 0, 0, _
oData.Tables("tblPurchaseDetails").Columns("pd3").ToString, DataRowVersion.Current, "pd3"))
oCommand.Parameters.Add(New SqlClient.SqlParameter("@pd4", SqlDbType.VarChar, 3, ParameterDirection.Input, False, 0, 0, _
oData.Tables("tblPurchaseDetails").Columns("pd3").ToString, DataRowVersion.Current, "pd3"))
oCommand.Parameters.Add(New SqlClient.SqlParameter("@pd5", SqlDbType.Int, 4, ParameterDirection.Input, False, 0, 0, _
oData.Tables("tblPurchaseDetails").Columns("pd5").ToString, DataRowVersion.Current, "pd5"))
oCommand.Parameters.Add(New SqlClient.SqlParameter("@pd6", SqlDbType.Int, 4, ParameterDirection.Input, False, 0, 0, _
oData.Tables("tblPurchaseDetails").Columns("pd6").ToString, DataRowVersion.Current, "pd6"))
oCommand.Parameters.Add(New SqlClient.SqlParameter("@pd7", SqlDbType.Money, 9, ParameterDirection.Input, False, 0, 0, _
oData.Tables("tblPurchaseDetails").Columns("pd7").ToString, DataRowVersion.Current, "pd7"))
oCommand.Parameters.Add(New SqlClient.SqlParameter("@pd8", SqlDbType.Money, 9, ParameterDirection.Input, False, 0, 0, _
oData.Tables("tblPurchaseDetails").Columns("pd8").ToString, DataRowVersion.Current, "pd8"))
oCommand.Parameters.Add(New SqlClient.SqlParameter("@pd9", SqlDbType.VarChar, 2, ParameterDirection.Input, False, 0, 0, _
oData.Tables("tblPurchaseDetails").Columns("pd9").ToString, DataRowVersion.Current, "pd9"))
oCommand.Parameters.Add(New SqlClient.SqlParameter("@pd10", SqlDbType.DateTime, 8, ParameterDirection.Input, False, 0, 0, _
oData.Tables("tblPurchaseDetails").Columns("pd10").ToString, DataRowVersion.Current, "pd10"))
oAdapter.InsertCommand = oCommand
oAdapter.Update(oData, "tblPurchaseDetails")
But, error message "Invalid object Name 'db_PurchDet'" always shown.
Can you help me....??????