Insert data into a MS SQL database with .NET SQL Data Provider in ASP.NET

                                                        
1
2
3 <%@ import namespace="system.data.sqlclient" %>
4 <Script runat="server">
5 Sub page_load
6 Dim dbconn as sqlconnection
7 Dim dbCMD as sqlCommand
8 dbConn = New SQLConnection ("Data Source=DBSERVERNAME;Initial Catalog=YOURDBNAME;User ID=YOURUSERID;Password=YOURPASSWORD")
9 dbConn.open()
10 dbCMD = new sqlcommand ("insert into tblTest values ('test')",dbconn)
11 dbCMD.executenonquery()
12 dbConn.close()
13 End Sub
14 Script>
15 Record Inserted
16
17
18

  • 0 Kasutajad peavad seda kasulikuks
Kas see vastus oli kasulik?

Seotud artiklid

Sample Code on Sending Email using ASP.NET 1

Our mail server is configured with SMTP authentication and all your code need to use SMTP...

Sample Code on how to send email using ASP.NET 2

For ASP.NET 2 you no longer using System.Web.Mail, but you will be using System.Net.Mail and the...

Query MySQL Database in ASP.net

1 2 3 <%@ Page Language="VB"...