ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
tip       Ask Questions on ANYTHING, that arise in your Daily Life at     FORUM9.COM
Google
 
Categories  >>  Software  >>  Microsoft Related  >>  VB.NET
 
 


 

 
 Visual Basic interview questions  Visual Basic Interview Questions
 C Sharp interview questions  C Sharp Interview Questions
 ASP.NET interview questions  ASP.NET Interview Questions
 VB.NET interview questions  VB.NET Interview Questions
 COM+ interview questions  COM+ Interview Questions
 ADO.NET interview questions  ADO.NET Interview Questions
 IIS interview questions  IIS Interview Questions
 MTS interview questions  MTS Interview Questions
 Crystal Reports interview questions  Crystal Reports Interview Questions
 BizTalk interview questions  BizTalk Interview Questions
 Dot Net interview questions  Dot Net Interview Questions
 Exchange Server interview questions  Exchange Server Interview Questions
 SharePoint interview questions  SharePoint Interview Questions
 Microsoft Related AllOther interview questions  Microsoft Related AllOther Interview Questions
Question
How to Insert a TextBox value in to Sql database using 
VB.Net coding?
 Question Submitted By :: May June
I also faced this Question!!     Rank Answer Posted By  
 
  Re: How to Insert a TextBox value in to Sql database using VB.Net coding?
Answer
# 1
Dim myConnection As SqlConnection
Dim myCommand As SqlCommand
Dim ra as Integer 
'integer holds the number of records inserted 
myConnection = New SqlConnection
("server=localhost;uid=sa;pwd=;database=Hospital") 
'you need to provide password for sql server
myConnection.Open()
mycommand = New SqlCommand("INSERT INTO Patient
(ID,Name,address,DateofBirth,Gender,Phone,Emergencycontact,D
ateofRegistration) VALUES('" + lblid.Text + "','" + 
txtname.Text + "','" + rtxtaddress.Text + "','" + 
DateTimePicker1.Text + "','" + cmbgender.Text + "','" + 
txtphone.Text + "','" + txtemcon.Text + "','" + 
txtdoreg.Text + "')", mycon)ra=myCommand.ExecuteNonQuery()
MessageBox.Show("New Row Inserted" & ra)
myConnection.Close()
 
Is This Answer Correct ?    3 Yes 4 No
Deepmala Soni
 
  Re: How to Insert a TextBox value in to Sql database using VB.Net coding?
Answer
# 2
Dim myConnection As SqlConnection
Dim myCommand As SqlCommand
Dim ra as Integer 
'integer holds the number of records inserted 
myConnection = New SqlConnection
("server=localhost;uid=sa;pwd=;database=Hospital") 
'you need to provide password for sql server
myConnection.Open()
mycommand = New SqlCommand("INSERT INTO Patient
(ID,Name,address,DateofBirth,Gender,Phone,Emergencycontact,D
ateofRegistration) VALUES('" + lblid.Text + "','" + 
txtname.Text + "','" + rtxtaddress.Text + "','" + 
DateTimePicker1.Text + "','" + cmbgender.Text + "','" + 
txtphone.Text + "','" + txtemcon.Text + "','" + 
txtdoreg.Text + "')", myconnection)
ra=myCommand.ExecuteNonQuery()
MessageBox.Show("New Row Inserted" & ra)
myConnection.Close()
 
Is This Answer Correct ?    8 Yes 1 No
Deepmala Soni
 
 
 
  Re: How to Insert a TextBox value in to Sql database using VB.Net coding?
Answer
# 3
dim con as new sqlconnection
dim da as sqldataadapter
dim ds as new dataset
dim str as string

con.connectionstring="server=localhost;uid=sa;pwd=;database=
Hospital"
con.open
str="insert into patient values('" & lblid.Text & "','" & 
txtname.Text & "','" & rtxtaddress.Text & "','" & 
DateTimePicker1.Text & "','" & cmbgender.Text & "','" & 
txtphone.Text & "','" & txtemcon.Text & "','" & 
txtdoreg.Text &"')"
da=new sqldataadpter(str,con)
da.fill(ds,"patient")
msgbox "New Row inserted"
con.close
 
Is This Answer Correct ?    6 Yes 3 No
Anusuya
 

 
 
 
Other VB.NET Interview Questions
 
  Question Asked @ Answers
 
What is versioning in .NET?  2
What are the objects in asp.net and tell the purpose of those objects Ascent2
What is VB.Net? Ksb3
what is the root namespace for all types?  5
How to Insert a TextBox value in to Sql database using VB.Net coding?  3
What is an abstract class?  3
What is an indexed property?  1
when a program of vb.net is written in notepad it occupies always 1kb of memory why?  1
Hi I am planning to take interview in VB.net,can any one share your interview Questions for a Entry-level job. Regards Lina  3
when we will use console ?  3
What is JIT(Just In Time) and How it works? Infocons3
Where would you use Abstract class and Interface?  2
How do you do multithreading application in VB ? Satyam4
In Datagrid after adding row, how you will assign the value for each cell to currently added new row?  1
how to call a list box on the text if some one send me the code for it  1
In order to get assembly info whcih namespace we should import?  1
ColumnMapping belongs to which namespaces?  1
what is vb.net?  9
What is intermediate language in .NET ? Digital-GlobalSoft13
What is the difference between Abstract Classes and Interfaces? Give the answer as a table format....  5
 
For more VB.NET Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com