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
Explain what the contents of cookie?
What are the various types of validation controls provided by asp.net?
What are different types of api?
What are the features that make asp.net more used framework? : asp.net mvc
How many types of session in ASP.NET
What do you mean by marshalbyref?
Explain the asp.net session state modes.
Is asp.net and .net same?
How does the service stream content?
What is the difference between mechine.config and web.config?
What is state management techniques in asp.net?
what is command line compiler.what are the steps and how it is related to debugging.
What are query strings used for?
What is an asp.net web form?
What are strong names?