konsep sistem saya adalah ini. saya sudah selesai menampilkan kolom dari tabel berbeda menggunakan gabungan dalam.
Saya merasa kesulitan karena, menurut saya Anda hanya dapat menggunakan perintah insert di sql ke satu tabel dalam satu waktu.
tetapi datagrid saya menampilkan kolom berbeda yang dipanggil dari tabel berbeda.
bagaimana struktur sintaks sql saya? dan juga memanggil prosedur tersimpan di vb.net 2003
terima kasih ada ide siapa pun
INI ADALAH PROC TERSIMPAN SQL SAYA
CREATE PROCEDURE AddToOfficeEquipmentProfile AS
INSERT INTO dbo.tblOfficeEquipmentProfile(OE_ID
, Report_ID
, OE_Category
, OE_SubCategory
, OE_Name
, OE_User
, OE_Brand
, OE_Model
, OE_Specs
, OE_SerialNo
, OE_PropertyNo
, OE_Static_IP
, OE_Vendor
, OE_PurchaseDate
, OE_WarrantyInclusiveYear
, OE_WarrantyStatus
, OE_Status
, OE_Dept_Code
, OE_Location_Code
, OE_Remarks)
VALUES
(DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT)
GO
INI ADALAH KODE VB SAYA
Dim sqlconn As New SqlClient.SqlConnection
sqlconn.ConnectionString = "server = SKPI-APPS1;" & _
"Database = EOEMS;integrated security=true"
Dim Command As SqlCommand = New SqlCommand
Command.Connection = sqlconn
Command.CommandText = "AddToOfficeEquipmentProfile"
Command.CommandType = CommandType.StoredProcedure
Dim sAdapter As SqlDataAdapter = New SqlDataAdapter(Command)
Dim DataSet As DataSet = New DataSet(Command.CommandText)
sAdapter.Fill(DataSet)
DataGrid1.DataSource = DataSet.Tables(0)
MsgBox(MsgBoxStyle.OKOnly, "YOU HAVE SUCCESSFULLY ADDED RECORDS TO THE TABLE")
itu mengembalikan kesalahan yang menunjuk ke
sAdapter.Fill(DataSet)
INILAH KODE KEDUA SAYA DI BAWAH INI TANPA PROSEDUR TERSIMPAN YANG DIPERLUKAN
Dim adapter As New SqlDataAdapter
Dim sql As String
sql = "INSERT INTO tblOfficeEquipmentProfile(OE_ID, Report_ID, OE_Category, OE_SubCategory, OE_Name, OE_User, OE_Brand, OE_Model, OE_Specs, OE_SerialNo, OE_PropertyNo, OE_Static_IP, OE_Vendor, OE_PurchaseDate, OE_WarrantyInclusiveYear, OE_WarrantyStatus, OE_Status, OE_Dept_Code, OE_Location_Code, OE_Remarks)VALUES(DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT)"
Try
sqlconn.Open()
adapter.InsertCommand = New SqlCommand(sql, sqlconn)
adapter.InsertCommand.ExecuteNonQuery()
MsgBox("Row inserted !! ")
Catch ex As Exception
MsgBox(ex.ToString)
End Try
tapi masih tidak berfungsi