Data Saving with stored procedure in VB.NET......

Unknown | 8:03 AM |

Dim cmm = New SqlCommand
            cmm.CommandType = CommandType.StoredProcedure
            cmm.CommandText = "sp_facility_addupdate"
            cmm.Parameters.Add("@facility_id", SqlDbType.BigInt, 0).Value = Convert.ToInt64(hdnFac_ID.Value)
            cmm.Parameters("@facility_id").Direction = ParameterDirection.InputOutput

            cmm.Parameters.Add("@location_id", SqlDbType.BigInt, 0).Value = Convert.ToInt64(Session("Location_ID"))

            cmm.Parameters.Add("@facility_name", SqlDbType.VarChar, 50).Value = txtFacNm.Text
            If ddl_FacilityType.SelectedValue = 1 Then
                cmm.Parameters.Add("@facility_type", SqlDbType.VarChar, 50).Value = "Production Facility"
            ElseIf ddl_FacilityType.SelectedValue = 2 Then
                cmm.Parameters.Add("@facility_type", SqlDbType.VarChar, 50).Value = "Repair Facility"
            ElseIf ddl_FacilityType.SelectedValue = 3 Then
                cmm.Parameters.Add("@facility_type", SqlDbType.VarChar, 50).Value = "Warehouse"
            ElseIf ddl_FacilityType.SelectedValue = 4 Then
                cmm.Parameters.Add("@facility_type", SqlDbType.VarChar, 50).Value = "Consolidation Center"
            End If
            cmm.Parameters.Add("@address_1", SqlDbType.VarChar, 50).Value = txtAddr1.Text
            cmm.Parameters.Add("@address_2", SqlDbType.VarChar, 50).Value = txtAddr2.Text
            cmm.Parameters.Add("@city", SqlDbType.VarChar, 50).Value = txtCity.Text
            cmm.Parameters.Add("@state", SqlDbType.VarChar, 50).Value = txtState.Text
            cmm.Parameters.Add("@country", SqlDbType.VarChar, 50).Value = ddl_country.SelectedValue
            cmm.Parameters.Add("@zip", SqlDbType.VarChar, 50).Value = txtZip.Text
            cmm.Parameters.Add("@phone", SqlDbType.VarChar, 50).Value = txtPhone.Text
            cmm.Parameters.Add("@isdcode", SqlDbType.VarChar, 20).Value = txtisdcode.Text
            cmm.Parameters.Add("@created_id", SqlDbType.BigInt, 0).Value = Convert.ToInt64(lblCreator_ID_Fac.Text)
            cmm.Parameters.Add("@last_update_id", SqlDbType.BigInt, 0).Value = Convert.ToInt64(dt.Rows(0)("user_id").ToString())

            DataConnect.GetInstance.ExecuteNonQuery(cmm)


Category:

About http://dotnetvisual.blogspot.in/:
DOT NET TO ASP.NET is a web application framework marketed by Microsoft that programmers can use to build dynamic web sites, web applications and web services. It is part of Microsoft's .NET platform and is the successor to Microsoft's Active Server Pages (ASP) technology. ASP.NET is built on the Common Language Runtime, allowing programmers to write ASP.NET code using any Microsoft .NET language. create an application very easily ....