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
How you will handle session when deploying application in more than a server?
Where is asp.net view state stored?
What is the significance of finalize method in .net?
What does session_start () do?
What is state management techniques in asp.net?
Which object is used to encapsulate the state of the client and the browser in ASP.NET?
Can you edit data in the Repeater control? Which template must you provide, in order to display data in a Repeater control? How can you provide an alternating color scheme in a Repeater control? What property must you set, and what method must you call in your code, in order to bind the data from some data source to the Repeater control?
List down the sequence of methods called during the page load.
how to transfer the file from client to server using asp.net
How to improve performance of web application asp.net mvc? : Asp.Net MVC
How many types of sessions are there in asp net?
What is loop in asp.net?
How can we prepairing Interview
Why is mvc better than asp.net?
What is asp net_sessionid?