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
what are configuration files?
What language does asp.net use?
What is a server cookie?
How to find last error which occurred?
How will you maintain versioning in asp.net 2.0?
How do you declare delegates and are delegates and events one and the same and explain how do you declare delegates and invoke them ?
Why do you use the app_code folder in asp.net?
Define tracing.
How many types of session state management options available in asp.net?
Explain the main function of razor in asp.net? : asp.net mvc
Do you know about caching with the datasource controls?
How would ASP and ASP.NET applications run at the same time on the same server?
What is ispostback method in asp.net?
How can you register a custom server control to a web page?
What is asp.net mvc5? : Asp.Net MVC