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
Explain about Visual basic.NET culture?
I Am Developing A project where I can send Message from One Computer to Another Computer With The Help Of LAN.Already I Have developed..It is working Fine With The Details Of ..TO,FROM,REF No,DATE,BODY...Now I Want To Add Attachments part in the same projects...How Can I Send Attachment File & How To Send It..I Am Working in VB.Net 2005 With out Any database. Can Any One Help me ??How To Write Code??Plz Send me a copy to my Mail also...I Dont Need Any Software Available in The Internet...Plz refer me The Code in VB.Net maloy.adhikari@in.com
How would you implement inheritance using vb.net?
What are nested classes?
What is strong typing and weak typing?
Explain how to achieve polymorphism in vb.net?
thak you Mr Govind for replying to my question. My next question is that how to retrieve image stored in an SQL server table and assign it to any image control or picture control using VB.net
What is multiple form in vb?
Explain about jagged arrarys ?
Define cls?
write a program to develop a graphic user interface application of marks book with students names and their names.the program should show the following options main menu,add student details,display student details,maximum mark and minimum mark.
Write a program to find all text files in a logical drive and return the count of the number of files?
What is globalization?
described weak typing?
Define manifest?