473,756 Members | 8,602 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem writing to SQL database--please help.

I have an asp form that sends data to a redirect page with SQL using JScript. There is a function that I'm using called replace(). The form submits without errors and goes to the redirect page but the data doesn't populate the SQL database. Instead, referrs to the last key ID.
------------------------
<%
function replace(string)
{
var pattern = /\'/g;
var newString = string.replace( pattern, "''");

// Create a database connection.

//Database.Open ("dsn=INTRANET" );

// Create a recordset of all information in this table.

// Construct the SQL Query
strSQL = "INSERT INTO " + ...

DirectoryRecord Set.Open (strSQL, Database);

return newString

}

%>

------------------------------

Please help!

Thank you!!

Jul 19 '05 #1
1 1408
A few tips:

Put a Response.end in your code before the redirect, so in the event of an
error, you see it.

Your replace function is fine.

DSNs use an ODBC connection, which is old technlogy. You're best off using
an OLEDB connection with a DSNless connection string.
http://www.aspfaq.com/show.asp?id=2126

When you insert data into a database, there is no need to create a recordset
object. Just execute your SQL command.
http://www.aspfaq.com/show.asp?id=2191

Ray at home
"Barnes" <Ba****@discuss ions.microsoft. com> wrote in message
news:31******** *************** ***********@mic rosoft.com...
I have an asp form that sends data to a redirect page with SQL using JScript. There is a function that I'm using called replace(). The form
submits without errors and goes to the redirect page but the data doesn't
populate the SQL database. Instead, referrs to the last key ID. ------------------------
<%
function replace(string)
{
var pattern = /\'/g;
var newString = string.replace( pattern, "''");

// Create a database connection.

//Database.Open ("dsn=INTRANET" );

// Create a recordset of all information in this table.

// Construct the SQL Query
strSQL = "INSERT INTO " + ...

DirectoryRecord Set.Open (strSQL, Database);

return newString

}

%>

------------------------------

Please help!

Thank you!!

Jul 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
3001
by: Syed Ghayas | last post by:
Hi, I've been having problem writing a cookie. Everything goes ok but when I supply the .Path property to "/" It just write the cookie when there is no cookie present, but when I try to update the cookie (or overwrite the cookie) it doesnt change it. My requirement to supply the path to "/" because ASP.NET reads it. If I write the cookie without supplying the path, the ASP.NET pages are unable to read the cookie.
4
3015
by: Gary Hughes | last post by:
Hi all, sometime I posted a problem in here where I was getting the following error from the linker in VS C++ 2003. Linking... GCClass.obj : error LNK2022: metadata operation failed (80131188) : Inconsistent field declarations in duplicated types (types: GCClass; fields: m_blah): (0x04000001). LINK : fatal error LNK1215: metadata operation failed (80131130) :
0
1129
by: Sukh | last post by:
Hi I am stuck with a problem Can anyone help me out from this... I am printing a report on pre-printed continue paper using dot-matrix printer using vb.net. Data is printing on all the locations. But After printing first page it increase paper 3cm vertically/Height so on second
2
1155
by: Eduardo Biano | last post by:
I am a python newbie and I have a problem with writing each record read to a file. The expected output is 10 rows of records, but the actual output of the code below is only one row with a very long record (10 records are lump into one record). Thank you in advance for your help. Here is the code: **************************************** infile = open('c:/grad3650txt.csv', 'r')
1
2537
by: brabster | last post by:
Hi, this is my first post so please excuse any mistakes! I'd like to write files using an upload script in my website, but I'm having problems. I don't seem to be able to write a file. Ive set up the following script to test this. It first reads a file successfully, then tries to write a file in the same directory. When run, the script stops at the line to open the file for writing without any errors. The permissions on the directory are 707,...
5
9280
by: vijay.db | last post by:
Hi Group, I'm running DB2 UDB Enterprise Edition V7.1 in AIX 4.3.3.0. And database backups goes to the TSM server. We have the following TSM Client API installed in the server: tivoli.tsm.client.api.aix43.32bit 5.1.6.0 C TSM Client - Application Programming Interface Now my backup getting terminated with the following message in the
19
4778
by: rmr531 | last post by:
First of all I am very new to c++ so please bear with me. I am trying to create a program that keeps an inventory of items. I am trying to use a struct to store a product name, purchase price, sell price, and a taxable flag (a Y/N char) and then write this all out to a file (preferably just a plain old text file) and then read it in later so that I can keep a running inventory. The problem that I am running into is when I write to the...
1
3391
by: daneshjo | last post by:
Hi im an IT student.I have registered as a member of this site recently.I have a question about the solution of maze program. I want to write maze program in c++ .I want to solve the maze class includes two methods: 1)makeMaze & 2)runMaze. I write the method of makeMaze in a way that fulls a n*n matrix. one of my problem is about the writing the code of dynamic 2D array allocation . an another is about the writing the method of runMaze in a...
4
1785
by: John Brock | last post by:
I have a .NET application that, among other things, creates Excel workbooks, and I have run into a very strange problem involving formulas on one worksheet that reference values on another worksheet. The text I write into, let's say, cell A25 on Sheet1 (using .NET) looks something like this: =VLOOKUP(RC,'Sheet2'!A:X,6,FALSE) On the completed workbook this turns into:
0
1283
oranoos3000
by: oranoos3000 | last post by:
hi i'm working with Macromedia flash 2004 and writing a text with Persian language that is a unicode utf-8 language but my problem is that letters of text that is writen with this language is seprated and is displayed deprecated my operating system is window xp would you please help me you please help me that this problem is solve thanks alot for your help sepideh mohseni
0
9212
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9973
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9790
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9779
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7186
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6473
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3742
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3276
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2612
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.