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...

detail code for sql data connections?

Answer Posted / bhagwat prasad sharma

Steps: SqlConnection with vb.net code
'' Code

imports system.data.sqlclients
Public Class Form1 Inherits System.Windows.Forms.Form
'' createconnection with database

dim con as new sqlconnection("server=bps; database=company; user id=sa; password=admin")

private sub button1_click()

dim str as string="insert into employee (roll_no,name,class) values(@roll_no,@name,@class)"

dim cmd as new sqlcommand =(str,con)

if con.state=connectionstate.closed than
con.open()
'' parameter passing

cmd.parameters.add("@roll_no",type.int)
cmd.parameters.add("@name",type.varchar)
cmd.parameters.add("@class",type.varchar)

cmd.parameters("@roll_no").value= txtroll.text
cmd.parameters("@name").value=txtname.text
cmd.parameters("@class").value= txtclass.text

dim i as integer
i=cmd.executeNonquery

if i>o
msgbox("addition successful")
else
msgbox("sum mistakes into add")
end if
' end of connection
con.close()
end sub
end class

Is This Answer Correct ?    2 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain what are delegates?

1107


List of words of preprocessor in .net?

945


What’s the difference between response .redirect and server.transfer?

1000


Is it possible to apply themes to an asp.net application? If yes, then how?

1019


What are Authentication and Authorization?

1108


How long do session variables last?

956


What is the benefit of WebAPI over WCF?

1011


What are the differences between the response.write() and response.output.write()?

1029


What is the function used for removing an event listener?

1024


How can we access static variable?

1098


What is asp.net and how it works?

1007


Describe how to implement globalization and localization in the use interface in .net.

963


What is GAC in ASP.NET 2.0

1162


What is directive in asp net?

1024


Is LINQ performance wise better or using sqlcommand?

5099