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 is asp.net mvc5? : Asp.Net MVC
Define a multilingual website?
Difference between .NET and previous version?
what are the Custom controls in asp.net?
3. What goals do you have in your career?
What does asax stand for?
What is difference between mvc and asp.net? : Asp.Net MVC
What is the difference between file-based dependency and key-based dependency?
How do you hide the columns?
Please brief not about xsd,xslt & xml?
How to count the number of objects present in a web page? How to count the number of radio buttons in a web page?
What is the use of autowireup in asp.net?
What is rending process in ASP.NET?
Explain the difference between overriding and overloading?
if i want to give an alert message like "try after sometime" to a web page which is being seen by other person.if a web page is not seen by anyone then it should display otherwise it show a display a message stating that other person is viewing so try after some time........how can i implement this.