You are on page 1of 2

***Store Procedure*** sp_I_Item_Prod ***Example of Script for Insert command*** dim connection as System.Data.SqlClient.SqlConnection; dim command as System.Data.SqlClient.

SqlCommand; dim commandText as string; dim MaterialID as string; dim MaterialLotID as string; dim MaterialSubLotID as string; dim QuantityScan as string; dim Quantity as string; dim DateEnd as string; dim SSCC as string; ' Connection to the database connection = new System.Data.SqlClient.SqlConnection (Me.SQL.Query.ConnectStri ng); connection.Open(); MaterialID = StringFromIntg( Me.SQL.Query.MaterialID, 10); MaterialLotID = Me.SQL.Query.MaterialLotID; MaterialSubLotID = Me.SQL.Query.MaterialSubLotID; QuantityScan = StringFromIntg( Me.SQL.Query.QuantityScan, 10); Quantity = StringFromIntg( Me.SQL.Query.Quantity, 10); DateEnd = Me.SQL.Query.DateEnd; if StringLen(MaterialSubLotID) > 14 Then SSCC = MaterialSubLotID; else SSCC = Me.SQL.Query.SSCC; endif; ' Insert in database commandText = "INSERT INTO MaterialScan (MaterialID, MaterialLotID, " + "MaterialSubLotID,SSCC, QuantityScan, Quantity, DateEn d, CreateBy)" + "VALUES ("+ MaterialID +", '"+ MaterialLotID + "','"+ MaterialSubLotID +"','"+SSCC+"',"+ QuantityScan +","+ Quantity + ",'"+ DateEnd +"','MES')"; ' Retrieve information from the database command = new System.Data.SqlClient.SqlCommand (commandText,connection); ' Execute Query command.ExecuteNonQuery(); ' Close connection to the database connection.Close(); ****data of item_prod**** wo_id oper_id seq_no shift_start_utc shift_start_local item_id lot_no rm_lot_no sublot_no rm_sublot_no reas_cd user_id ent_id shift_id grade_cd status_cd to_ent_id good_prod qty_prod qty_ prod_erp processed_flag byproduct ext_ref move_status genealogy_id event_id segment_requirement_ id segment_response_id comments spare1 spare2 spare3 spare4 last_edit_comment la st_edit_by last_edit_at created_at_utc created_at_local row_id 11106958 Evaporator 01 0 2011-11-24 16:00:55.000 2011-11-24 21:00:55.000

41060172EV 1581BT1132901 NULL NULL NULL 0 Default Back ground User 350 0 0 0 299 1 1337 0 0 1 NULL 0 OCO_Produced_002|Produced| 2011-11-27 10:16:41.356 41060172EV|2011-11-27 10:16:42.356 NULL EVA1_S1329001 NULL NULL NULL NULL NULL NULL sa 2011-11-27 10:17:06.000 2011-11-27 10:16:42.000 2011-11-27 15:16:42 .000 13362

You might also like