Solved

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

Posted on 2004-03-29
1
131 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 125 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Create 4 <div> below each other in php 2 72
two submit buttons one form 15 114
Specific format 21 238
Problem to ToolkitScriptManager 2 86
Article by: Matthew
I am a very big proponent of technology compliance standards and strive to meet such criteria in all of my work. That includes my site, which is 100% XHTML 1.0 compliant as determined by the World Wide Web Consortium. https://www.matthewstevenkel…
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

737 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