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

Thank you for replying to my Question regarding Barcodes in VB.net. My next question is that how to use Barcode Fonts in VB.net I need a small code to Generate Barcodes in VB.net from a string of Values. This is the only problem i am left with in my project. Any body can help me please.

2239


List the types of generations in garbage collector?

683


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

705


Which is the tool which can convert visual basic old version to .net compatibility version?

712


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

782


What do you mean by serialization and deserialization and it's use.

831


Is vb.net dead?

716


How do you define a read only property in a class module?

712


what is interface and when it is used?

2016


What are all the parts of .net framework?

737


What is the feature anonymous type?

694


What is strong name in .net assembly?

718


What is sealed class?

818


What is normal jit?

798


hello thank you for replying to my question regarding adding barcode fonts in vb.net project. I have downloaded a free font and added in my vb.net project but now i dont know how to use that i need to generate barcodes can any body help me how to use those fonts these are font3of9 .i need a small code to use these fonts to generate barcode thank u!

1771