Monday, May 10, 2010

TXTBOX...Enter Data Saving in the Mysql Table thru VB.Net Code

Protected Sub btnSave_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSave.Click



Dim xx As String() = txtEmpdob.Text.Split("/")
Dim yy As String = (((xx(2).ToString & "-") + (xx(1).ToString & "-") + (xx(0).ToString)))
Dim cc As String() = txtEmpdoj.Text.Split("/")
Dim dd As String = (((cc(2).ToString & "-") + (cc(1).ToString & "-") + (cc(0).ToString)))


Dim strSql As String = ""
strSql = "insert into tab_employee (empcode,empname,empdob,empdoj,emplmntype,empdept,empnationality,empnricno,mthrtngue,mobileno,gender,maritalsts,religion,qualifications,certifications,specializations,yrsofexprnce,prvscomp,designation,lstdrawnsalary,noofmnthswrkd,awards,activities,hobbies,refname1,refcontact1,refname2,refcontact2,prsntaddress,permanentaddress) values('" & txtEmpCode.Text & "','" & txtEmpName.Text & "','" & yy & "','" & dd & "','" & ddlEmpType.SelectedValue & "','" & ddlEmpldept.SelectedValue & "','" & txtempnasnlty.Text & "','" & txtEmpnric.Text & "','" & txtEmpmthrtng.Text & "','" & txtEmpmobile.Text & "','" & ddlEmpGender.SelectedValue & "','" & ddlmaritalsts.SelectedValue & "','" & ddlreligion.SelectedValue & "','" & ddlqualifications.SelectedValue & "','" & txtEmpcertifi.Text & "','" & txtEmpSpeclzsn.Text & "','" & txtEmpyrsfexp.Text & "','" & txtEmpprvcomp.Text & "','" & txtEmpDesigntsn.Text & "','" & txtEmplstdrwnsal.Text & "','" & txtEmpmnthswrkd.Text & "','" & txtEmpAwards.Text & "','" & txtEmpActivities.Text & "','" & txtEmphobbies.Text & "','" & txtrefname1.Text & "','" & txtrefcontact1.Text & "','" & txtrefname2.Text & "','" & txtrefcontact2.Text & "','" & txtpresentadd.Text & "','" & txtpermanent.Text & "')"


sqlDB.savedata(strSql)
End Sub