Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

How to Insert a TextBox value in to Sql database using
VB.Net coding?

Answer Posted / dinesh

Imports System.Configuration
Imports System.Data.SqlClient

Public Class Form1
Dim objcon As SqlConnection
Dim objcmd As SqlCommand

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
objcon.Open()
objcmd = New SqlClient.SqlCommand("insert into customer_master(First_Name,Last_Name,Address,contact_number,email_id)values('" & TextBox1.Text.Trim & "','"& TextBox2.Text.Trim &"','"& TextBox3.Text.Trim &"','" & TextBox5.Text.Trim & "','" & TextBox7.Text.Trim & "')", objcon)
Dim i As Integer = objcmd.ExecuteNonQuery()
If (i > 0) Then
MsgBox("Customer saved successfully!")
Else
MsgBox("Failed to save Customer!")
End If
objcon.Close()
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub

Is This Answer Correct ?    8 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can you please explain the difference between thread and process?

922


What is sealed class?

1073


What is a static class?

970


Allowed program to auto-correct the database when loading a presentation.

2204


What is stack used for in vb. Net?

891


Explain about globalization?

819


what is commom language runtime?

927


What is meant by jagged arrays?

980


Explain the difference between vb.net and c#, related to oops concepts?

891


How vb implements the disconnected architecture as like vb.net?

958


How to send xml file on server using http protocol?

949


what is difference between web.config and machine.config and where it will be ?

893


What is the Advantage of vb.net over vb

952


What are the differences between vb.net and c#, related to oops concepts

935


What is difference between import system.data.sqlclient,system.data.oledb?

972