Imports System.Data
Imports System.Data.SqlClient
Imports System.Configuration
Public Class car_type
Inherits System.Web.UI.Page
Dim conn As SqlConnection
Dim connectionString As String
Dim cmd As SqlCommand
Dim txtsql As String
Dim cm As Integer
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
connectionString = ConfigurationManager.ConnectionStrings("VipcoRiggingConnectionString").ToString
Me.txtctymf.Text = Session("User")
Me.txtctymd.Text = Date.Now()
End Sub
Protected Sub ImageButton1_Click(sender As Object, e As ImageClickEventArgs) Handles ImageButton1.Click
connectionString = ConfigurationManager.ConnectionStrings("VipcoRiggingConnectionString").ToString
Try
txtsql = " insert into tcartype(CT_Code,CT_Desc,CT_Remark,Creator,CreateDate,Modifyer,ModifyDate)VALUES(@CTID,@CTDesc,@CTRemark,@CTCreator,@CTCreateDate,@CTModifyer,@CTModifyDate)"
conn = New SqlConnection(connectionString)
cmd = New SqlCommand(txtsql, conn)
cmd.Parameters.Clear()
cmd.Parameters.AddWithValue("CTID", Me.txtctyid.Text.Trim)
cmd.Parameters.AddWithValue("CTDesc", Me.txtctydesc.Text.Trim)
cmd.Parameters.AddWithValue("CTRemark", Me.txtctyre.Text.Trim)
cmd.Parameters.AddWithValue("CTCreator", Me.txtctyct.Text.Trim)
cmd.Parameters.AddWithValue("CTCreateDate", Me.txtctycd.Text.Trim)
cmd.Parameters.AddWithValue("CTModifyer", Me.txtctymf.Text.Trim)
cmd.Parameters.AddWithValue("CTModifyDate", Me.txtctymd.Text.Trim)
conn.Open()
cm = cmd.ExecuteNonQuery()
conn.Close()
If (txtctyid.Text = "") Then
MsgBox("Please Insert Car Type ID")
ElseIf (txtctydesc.Text = "") Then
MsgBox("Please Insert Car Description")
Else
cm = 1
MsgBox("Save Data Complete")
'Response.AppendHeader("Refresh", "1")
Me.txtctyid.Text = ""
Me.txtctydesc.Text = ""
Me.txtctyre.Text = ""
End If
Catch ex As Exception
MsgBox("Error" & ex.Message)
End Try
End Sub