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   To Refer this Site to Your Friends   Click Here
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 ?    6 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
 
How does you get record no from 5 to 15 from a dataset of 100 records? ABC2
Disadvantages of vb ? Digital-GlobalSoft4
what is the dif b/w panel and groupbox. Ksb3
1234 123 12 1 how to design above pic in vb.net? ABC2
what r the properties should be given to set method? PSI-Data-Systems2
What is MSIL  4
hi dear ? MY problem is that i m developing software for Library. and i want to connect a third party software with my VB.net program in order to calculate DDC number.I dont know how to do this if any body can help me please?  1
What is versioning in .NET?  2
how can we assigns items on listbox so that it will show rowwise please write the code for it.  3
Trace and Debug belongs to which namespaces?  4
hello dear friends my problem is that i want to save images that is pictures in SQL server using vb.net can any body help me to do so please  1
What is an indexed property?  1
In vb.net how to connect crystal report?  1
In order to get assembly info whcih namespace we should import?  1
How do you declare static variable and how it is declared and what is its lifetime? Infosys3
how to connect crystal report with vb.net ? Patni2
sir how i can calculate the value of two-textbox of gridview and show result in textbox within gridview in asp.net with vb.net..plz sir reply me Biz-Technology1
what is the base class of .net?  6
how to send data to exe file? my code has a button when i press it, an exe file will open. how can i send data as input to the exe file?  2
How do you rate yourself in .NET ? Infosys3
 
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