?
Solved

How do i change this insert from into a access db to an sql in asp.net

Posted on 2004-03-29
1
Medium Priority
?
135 Views
Last Modified: 2012-05-04
I have the below code inserting data into an access database nit I not sure what needed to be changed to make it insert the data into an sql db.

Dim strConn as string ="PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" & server.mappath("db/emails.mdb") & ";"
Dim conn As New OLEDBConnection(strConn)
Dim cmdinsert As OLEDBCommand

cmdInsert = New OLEDBCommand("Insert into emaildet (name, email) VALUES ('" + Request.Params("name") + "','" + Request.Params("email") + "')", conn)
conn.Open()
cmdInsert.ExecuteNonQuery()
conn.close

Thanks in advance
0
Comment
Question by:dexine
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 35

Accepted Solution

by:
YZlat earned 250 total points
ID: 10710132
Dim strConn as string ="PROVIDER=SQLOLEDB;DATA SOURCE=sqlservername;UID=username;PWD=password;DATABASE=databasename "

Dim conn As New SQLConnection(strConn)
Dim cmdinsert As SQLCommand

cmdInsert = New SQLCommand("Insert into emaildet (name, email) VALUES ('" + Request.Params("name") + "','" + Request.Params("email") + "')", conn)
conn.Open()
cmdInsert.ExecuteNonQuery()
conn.close

0

Featured Post

Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preface In the first article: A Better Website Login System (http://www.experts-exchange.com/A_2902.html) I introduced the EE Collaborative Login System and its intended purpose. In this article I will discuss some of the design consideratio…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will learn how to dynamically set the form action using jQuery.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
Suggested Courses

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question