Showing posts with label page. Show all posts
Showing posts with label page. Show all posts

Sunday, March 25, 2012

ASP...

Let say I pass values from first page to second page using a form, how can I
retain the value in the corresponding area (text, radio button, texarea, dro
p
down menu)in the first page when i press the back button on the second page.
--
regards seowhuaYou've posted to the wrong newsgroup - this is for SQL Server, not ASP
programming. I'd try posting your question to one of the
microsoft.public.dotnet.framework.aspnet.* newsgroups. (Ditto for your
"ASP Calendar..." post too.)
*mike hodgson*
blog: http://sqlnerd.blogspot.com
seowhua wrote:

>Let say I pass values from first page to second page using a form, how can
I
>retain the value in the corresponding area (text, radio button, texarea, dr
op
>down menu)in the first page when i press the back button on the second page
.
>sql

ASP, SQL, long text data problems...

I have an ASP page that will take form info that a user has entered,
then save it into SQL server, and retrive and display the info on
another page. My problem is with long text data (10,000 bytes or
more). It appears to save the long text data, as in it gives no
errors... but it does not save it. In the SQL table, the field is
defined as ntext... So why won't it save?

Thanks in advance,
adamAdam (ootena@.imsg.com) writes:
> I have an ASP page that will take form info that a user has entered,
> then save it into SQL server, and retrive and display the info on
> another page. My problem is with long text data (10,000 bytes or
> more). It appears to save the long text data, as in it gives no
> errors... but it does not save it. In the SQL table, the field is
> defined as ntext... So why won't it save?

I guess you need to post your code, so that people here can have a
reasonble chance to spot your error. You are using the AppendChunk on
the Field object?

--
Erland Sommarskog, SQL Server MVP, sommar@.algonet.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp|||Adam (ootena@.imsg.com) writes:
> I guess I need an example of the GetChunk, AppendChunk... I havent
> been able to find one that makes sense to me.

In the MDAC Books Online there are examples of using AppendChunk. This
should also be on MSDN.

Did you try searching for AppendChunk on Google? I seem to get quite some
hits.

--
Erland Sommarskog, SQL Server MVP, sommar@.algonet.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp|||Cool, thanks for the books online... that helped a lot later man

ASP upload image file

Im writing an asp page which allows users to upload files which are then
saved in a database table as an image. The problem is that the webpage is on
one server and the data is stored on another server, I can save the image to
the server the webpages are on but not the other, just get the error:
ADODB.Recordset error '800a0cb3'
Current Recordset does not support updating. This may be a limitation of the
provider, or of the selected locktype.
Is it possible to do this?
Chris,
is the db on the same internal network as the webserver?
if it is i dont think thats your problem, post some code.
Mike
www.michaelevanchik.com
"chris2583" wrote:

> Im writing an asp page which allows users to upload files which are then
> saved in a database table as an image. The problem is that the webpage is on
> one server and the data is stored on another server, I can save the image to
> the server the webpages are on but not the other, just get the error:
> ADODB.Recordset error '800a0cb3'
> Current Recordset does not support updating. This may be a limitation of the
> provider, or of the selected locktype.
> Is it possible to do this?
|||For Each File In Uploader.Files.Items
' Open the table you are saving the file to
Set RS = Server.CreateObject("ADODB.Recordset")
RS.Open "select * from test",conn,2,2
RS.AddNew ' create a new record
RS("filename") = File.FileName
RS("filesize") = File.FileSize
RS("contenttype") = File.ContentType
' Save the file to the database
File.SaveToDatabase RS("filedata")
' Commit the changes and close
RS.Update
RS.Close
Next
All the servers are on the same internal network. I have an included asp
page which has the FileUploader class. This is the code that works, when I
change source parameter in the RS.Open line to the table on the other server
it fails on the RS.AddNew line.
"Michael Evanchik" wrote:

> Chris,
> is the db on the same internal network as the webserver?
> if it is i dont think thats your problem, post some code.
> Mike
> www.michaelevanchik.com
>
sql

ASP upload image file

Im writing an asp page which allows users to upload files which are then
saved in a database table as an image. The problem is that the webpage is on
one server and the data is stored on another server, I can save the image to
the server the webpages are on but not the other, just get the error:
ADODB.Recordset error '800a0cb3'
Current Recordset does not support updating. This may be a limitation of the
provider, or of the selected locktype.
Is it possible to do this?Chris,
is the db on the same internal network as the webserver?
if it is i dont think thats your problem, post some code.
Mike
www.michaelevanchik.com
"chris2583" wrote:

> Im writing an asp page which allows users to upload files which are then
> saved in a database table as an image. The problem is that the webpage is
on
> one server and the data is stored on another server, I can save the image
to
> the server the webpages are on but not the other, just get the error:
> ADODB.Recordset error '800a0cb3'
> Current Recordset does not support updating. This may be a limitation of t
he
> provider, or of the selected locktype.
> Is it possible to do this?|||For Each File In Uploader.Files.Items
' Open the table you are saving the file to
Set RS = Server.CreateObject("ADODB.Recordset")
RS.Open "select * from test",conn,2,2
RS.AddNew ' create a new record
RS("filename") = File.FileName
RS("filesize") = File.FileSize
RS("contenttype") = File.ContentType
' Save the file to the database
File.SaveToDatabase RS("filedata")
' Commit the changes and close
RS.Update
RS.Close
Next
All the servers are on the same internal network. I have an included asp
page which has the FileUploader class. This is the code that works, when I
change source parameter in the RS.Open line to the table on the other server
it fails on the RS.AddNew line.
"Michael Evanchik" wrote:

> Chris,
> is the db on the same internal network as the webserver?
> if it is i dont think thats your problem, post some code.
> Mike
> www.michaelevanchik.com
>

ASP sp execution returning closed recordset

Can anybody tell me why a) when running a stored proc from an asp page to
return a recordset the command succeeds if the sp queries an existing table
directly, but b) if the stored proc populates results into a different
table, temporary table, global temp table, or table variable, then queries
one of these, the asp page reports that the recordset object is closed. If
using a table, I have set grant, select, update, delete permissions for the
asp page user account, so it doesn't appear to be a permissioning issue. If
run in Query Analyser the sp runs fine of course.

Abridged asp code is as follows:
StoredProc = Request.querystring("SP")
oConn.ConnectionString = "Provider=SQLOLEDB etc"
oConn.Open
set oCmd = Server.CreateObject("ADODB.Command")
oCmd.ActiveConnection = oConn
oCmd.CommandText = StoredProc
oCmd.CommandType = adCmdStoredProc
oCmd.Parameters.Refresh
'code here that populates the parameters of the oCmd object correctly
Set oRs = Server.CreateObject("ADODB.Recordset")
With oRS
.CursorLocation = adUseClient
.CursorType = adOpenStatic
.LockType = adLockBatchOptimistic
'execute the SP returning the result into a recordset
.Open oCmd
End With
' Save data into IIS response object
Response.ContentType = "text/xml"
oRs.Save Response, adPersistXML
'the line above fails with stored procs from example B below, reporting "not
allowed when object is closed", but works with example A

SP Example A - this one works fine
Create Proc spTestA AS
SELECT ID FROM FileList
GO

SP Example B - this one doesn't work from ASP but runs fine in QA
Create Proc spTestB AS
DECLARE @.Results Table (ID TinyInt)
INSERT INTO @.Results SELECT ID FROM FileList
SELECT ID FROM @.Results
GO

I can see the SP executing using profiler when the asp page is called for
both sp's above, so it doesn't appear to be a problem with the execution.
It's something to do with returning the result set from the table variable.

Thanks,

Robin Hammond"Robin Hammond" wrote:

<snip
> SP Example B - this one doesn't work from ASP but runs fine in QA
> Create Proc spTestB AS
> DECLARE @.Results Table (ID TinyInt)
> INSERT INTO @.Results SELECT ID FROM FileList
> SELECT ID FROM @.Results
> GO

<snip
Robin,

The problem is that you're getting back a closed recordset with "records
affected" info from SQL Server: using the NextRecordset method in ADO will
get the actual recordset you're looking for. A good rule of thumb is to
watch the output from a stored proc in QA: anytime you see a resultset or a
message about records affected, then you know this could pop up.

A more efficient solution (and the one I prefer) if you don't need any data
back but the result of the SELECT is to use SET NOCOUNT...

Create Proc spTestB AS
SET NOCOUNT ON
DECLARE @.Results Table (ID TinyInt)
INSERT INTO @.Results SELECT ID FROM FileList

SET NOCOUNT OFF
SELECT ID FROM @.Results
GO

Craigsql

Thursday, March 22, 2012

ASP Pages on Windows Longhorn

Hello Guys,
I have .asp installed on longhorn server and everytime I goto look at the
page, I get a 500 internal server error..
Anyone got any suggestions!
Thanks
J Bowman
jbowman@.neo.rr.comYou might ask them here.
http://forums.microsoft.com/TechNet/default.aspx?ForumGroupID=161&SiteID=17
http://www.microsoft.com/communities/newsgroups/en-us/default.aspx?dg=microsoft.public.inetserver.iis&cat=en_US_02ceb021-bb43-476d-8f8f-6c00a363ccf5&lang=en&cr=US
--
Regards,
Dave Patrick ...Please no email replies - reply in newsgroup.
Microsoft Certified Professional
Microsoft MVP [Windows]
http://www.microsoft.com/protect
"J Bowman [293288]" wrote:
| Hello Guys,
|
| I have .asp installed on longhorn server and everytime I goto look at the
| page, I get a 500 internal server error..
|
| Anyone got any suggestions!
|
| Thanks
| J Bowman
| jbowman@.neo.rr.com
|
||||Got it to work... thanks for your help
"Dave Patrick" <DSPatrick@.nospam.gmail.com> wrote in message
news:uxR7M5%23vGHA.5084@.TK2MSFTNGP04.phx.gbl...
> You might ask them here.
> http://forums.microsoft.com/TechNet/default.aspx?ForumGroupID=161&SiteID=17
> http://www.microsoft.com/communities/newsgroups/en-us/default.aspx?dg=microsoft.public.inetserver.iis&cat=en_US_02ceb021-bb43-476d-8f8f-6c00a363ccf5&lang=en&cr=US
> --
> Regards,
> Dave Patrick ...Please no email replies - reply in newsgroup.
> Microsoft Certified Professional
> Microsoft MVP [Windows]
> http://www.microsoft.com/protect
> "J Bowman [293288]" wrote:
> | Hello Guys,
> |
> | I have .asp installed on longhorn server and everytime I goto look at
> the
> | page, I get a 500 internal server error..
> |
> | Anyone got any suggestions!
> |
> | Thanks
> | J Bowman
> | jbowman@.neo.rr.com
> |
> |
>

asp page variable to sql to openquery

Im having trouble putting all of this together, but here is the
scenario
ASP page with a Query String Variable,
Example: http://mywebsite/mywebpage.aspx?variable=x
now i need to query using openquery across a linked server using this
variable.
Like:
SELECT COLUMN1, COLUMN2
FROM OPENQUERY(LINKEDSERVER, '
SELECT COLUMN1, COLUMN2
FROM LINKEDSERVERTABLE
WHERE COLUMN3=@.VARIABLE')
I know this won't work, but this is the concept, if i run the query
against the linked server then my results take about 20 seconds to
return, but if i could pass the variable to an openquery then my
results would be returned in 1-2 seconds. which is acceptable. Thanks
for any help in advance!!You need to build the SQL statement as a string and
then pass that string to an EXEC. You can find more
information and an example in the following article:
HOW TO: Pass a Variable to a Linked Server Query
http://support.microsoft.com/?id=314520
-Sue
On 3 Aug 2006 16:07:15 -0700, joshd@.norrisinc.com wrote:

>Im having trouble putting all of this together, but here is the
>scenario
>ASP page with a Query String Variable,
>Example: http://mywebsite/mywebpage.aspx?variable=x
>now i need to query using openquery across a linked server using this
>variable.
>Like:
> SELECT COLUMN1, COLUMN2
> FROM OPENQUERY(LINKEDSERVER, '
> SELECT COLUMN1, COLUMN2
> FROM LINKEDSERVERTABLE
> WHERE COLUMN3=@.VARIABLE')
>I know this won't work, but this is the concept, if i run the query
>against the linked server then my results take about 20 seconds to
>return, but if i could pass the variable to an openquery then my
>results would be returned in 1-2 seconds. which is acceptable. Thanks
>for any help in advance!!

ASP Page to run a Report

I am trying to create a report (form) to run from an ASP page with one
single prompt. The ASP pagre would then populate the parameter below
as it passes the data to Report Manager. I am tring to skip the step
of opening IE and go straight to the PDF.
Example
Enter Shipment# [2022222]
[Sumbit] [Quit]
shipnum=variable above
http://rpt-serv/ReportServer?/sales%2fC+of+C&shipnum=2022222&rs:Format=PDF
Does anyone have a sample ASP page they would be willing to share?
Thanks
BobThis may be way more than what you need, but search this newsgroup for my
post on 12/11/07 with the terms "Classic ASP" or Google ""Reporting Service
in Classic ASP" to do exactly what I think you want. Once the PDF is
rendered you can open it in IE, save it, or save it directly as a file on a
server (by taking the stream and writing it).
"Bob" <bob@.ebearings.com> wrote in message
news:fa89138c-aa86-41c8-bdc2-c0fe620972d9@.e4g2000hsg.googlegroups.com...
>I am trying to create a report (form) to run from an ASP page with one
> single prompt. The ASP pagre would then populate the parameter below
> as it passes the data to Report Manager. I am tring to skip the step
> of opening IE and go straight to the PDF.
> Example
> Enter Shipment# [2022222]
> [Sumbit] [Quit]
> shipnum=variable above
> http://rpt-serv/ReportServer?/sales%2fC+of+C&shipnum=2022222&rs:Format=PDF
> Does anyone have a sample ASP page they would be willing to share?
> Thanks
> Bob

ASP page to connect to SQL Server - please help

I don't know if this is the right forum or not, but it seemed like it might be the most appropriate, sorry if it is not:

I am learning about websites and I have a database that was created in access and then converted to sql server and is going to be hosted on a windows server running sql server 2000. I want to make a basic query so if I wanted to search for say buildings, I could retrieve everything in the buildings column, or if I wanted to do a seach for empire state building, I would get all hits displayed.

What type of connection string would I need to use? Do I have to configure the database itself at all?

Any help would be greatly appreciated, I am a complete novice with this type of stuff.There's a lot of information on tutorials section on these forums. Please check it out.sql

ASP only shows fields which contain numeric data

Hi

I'm using an SQL server database to run a website with ASP.

A new page I'm making will only display the contents on fields containing numeric data and it won't display text.

Other pages work fine. Does anyone have any ideas as to why this is happening - I've never seen in before.

Dave

http://pink-football.com/gossip.aspCould you use one of your ASP variables to be use with a number operator? like "+" or sumthin?

or

How are you calling your SQL server scripts? Through inline with your ASP codes or trough store procedures.

In either case, check your passing of ASP variable into your SQL Script.
Maybe you could miss a '' character.

What is the actual ASP error msg??|||Is it an error or just no data is returned ? Is your query returning both numerics and string data and only the numeric data is showing ? Have you tried to do a response.write to display all fields being returned ? Is it possible that you have single quotes in your string data ? On your web site - what are we looking for - and boy is it pink !!!

asp HTTP 500 error

Hello there,

I have created a login page for users. The login page contain <FORM action="verifyuser.asp" method="post">. The verifyuser page verify that the user exist in the database. All the pages, home, login, memberspage, updatemember, seems to be working properly except for the verifyuser page. This is the code for the page:

<%
Dim objConn, oRSu
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open "Provider=SQLOLEDB.1;Persist Security Info=False;"& _
"User ID=sa;Password=test12345; Initial Catalog=members;Data Source= Kai-PC;"

dim varUsername, varPassword
varUsername = Request.Form("Username")
varPassword = Request.Form("Password")

set oRSU=server.CreateObject("adodb.recordset")
SQL = "Select * from Users where Username = '" & varUsername & "' AND
Password = '"& varPassword &"'"
oRSu.open SQL, objConn
If oRSu.EOF Then
response.redirect "Login.asp"
end if
Session("Username") = oRSu("Username")
Session("password") = oRSu("password")

Response.redirect "memberspage.asp"
oRSu.Close
set oRSu=nothing
%>

Whenever I try to login a HTTP 500 Internal Server Error appears... I have no idea whether that caused by the codes or because I'm using Vista? Thanks

If I recall, HTTP 500 is a login/security error.

On another VERY important point.

Assuming the above error is corrected, What do you think would be the result if the user were to type the following in the UserName textbox on the Login.asp page? (Type the characters between the square brackets.)

['' or 1=1--]

Eleven characters. This is a widely known and significant security breach that many web developers make -you are not alone...

An even worst mistake is that you are using the 'sa' account - for after the 'hacker' uses the above exploit, he/she is in your database operating under the 'sa' account. At that moment, the hacker 'owns' your database, and your entire server and all other databases on the server. And depending upon your network security, he/she may be able to access other servers and resources on your network.

Yes, you have another redirect, but that is a minor inconvenience to a hacker...

Is the first row in the users table the administrator? Quite often the case...

Suddenly not feeling too comfortable, wondering if your rsum needs updating, thinking that now might be a good time to start that other business you've been dreaming about?

Perhaps reading these articles will help ease the rush of anxiety...

Security –Best Practices
http://vyaskn.tripod.com/sql_server_security_best_practices.htm

Security –Protecting against Hacking and Password Cracking
http://www.airscanner.com/pubs/sql.pdf#search=%22sql%20server%20password%20crack%20sqlping%22

Overview of the SQL Server Security Model and Security Best Practices
http://www.sql-server-performance.com/vk_sql_security.asp

You might wish to check out www.SQLSecurity.com



sql

ASP error while accessing the website

Hi
I get different errors when I access the same web page....This page opens a
ADO connection....
First time --
__________________________________________________ ___
Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[Microsoft][ODBC SQL Server Driver]Timeout expired
/common/common.asp, line 65
_______________________________________________--
Another time...I got an Invalid connection error..
Can someone tell me what the problem really is...The website was working
perfectly fine until few days agao..There were no changes to the ASP code...
Thanks & Regards
Imtiaz
sql client changed from tcp\ip to named pipes ?
nic card setting set from 100mb Full to "Auto"
?
Greg Jackson
PDX, Oregon
|||Timeout occurs if you don't take network congestion (i.e. lag) into account.
Double check your connection string to see if you have given enough time for
sql connection (default is 15 sec) and sql command execution (default is 30
sec).
-oj
"Imtiaz" <Imtiaz@.discussions.microsoft.com> wrote in message
news:F757C5B8-0EC9-4A09-888E-6A7282DFC922@.microsoft.com...
> Hi
> I get different errors when I access the same web page....This page opens
> a
> ADO connection....
> First time --
> __________________________________________________ ___
> Microsoft OLE DB Provider for ODBC Drivers error '80004005'
> [Microsoft][ODBC SQL Server Driver]Timeout expired
> /common/common.asp, line 65
> _______________________________________________--
> Another time...I got an Invalid connection error..
> Can someone tell me what the problem really is...The website was working
> perfectly fine until few days agao..There were no changes to the ASP
> code...
>
> Thanks & Regards
> Imtiaz
>
|||Problem has been solved...Web Server wasn't able to ping to SQL Server
properly...
Thanks for your replies...
"oj" wrote:

> Timeout occurs if you don't take network congestion (i.e. lag) into account.
> Double check your connection string to see if you have given enough time for
> sql connection (default is 15 sec) and sql command execution (default is 30
> sec).
> --
> -oj
>
> "Imtiaz" <Imtiaz@.discussions.microsoft.com> wrote in message
> news:F757C5B8-0EC9-4A09-888E-6A7282DFC922@.microsoft.com...
>
>

ASP error while accessing the website

Hi
I get different errors when I access the same web page....This page opens a
ADO connection....
First time --
________________________________________
_____________
Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[Microsoft][ODBC SQL Server Driver]Timeout expired
/common/common.asp, line 65
________________________________________
_______--
Another time...I got an Invalid connection error..
Can someone tell me what the problem really is...The website was working
perfectly fine until few days agao..There were no changes to the ASP code...
Thanks & Regards
Imtiazsql client changed from tcp\ip to named pipes ?
nic card setting set from 100mb Full to "Auto"
?
Greg Jackson
PDX, Oregon|||Timeout occurs if you don't take network congestion (i.e. lag) into account.
Double check your connection string to see if you have given enough time for
sql connection (default is 15 sec) and sql command execution (default is 30
sec).
-oj
"Imtiaz" <Imtiaz@.discussions.microsoft.com> wrote in message
news:F757C5B8-0EC9-4A09-888E-6A7282DFC922@.microsoft.com...
> Hi
> I get different errors when I access the same web page....This page opens
> a
> ADO connection....
> First time --
> ________________________________________
_____________
> Microsoft OLE DB Provider for ODBC Drivers error '80004005'
> [Microsoft][ODBC SQL Server Driver]Timeout expired
> /common/common.asp, line 65
> ________________________________________
_______--
> Another time...I got an Invalid connection error..
> Can someone tell me what the problem really is...The website was working
> perfectly fine until few days agao..There were no changes to the ASP
> code...
>
> Thanks & Regards
> Imtiaz
>|||Problem has been solved...Web Server wasn't able to ping to SQL Server
properly...
Thanks for your replies...
"oj" wrote:

> Timeout occurs if you don't take network congestion (i.e. lag) into accoun
t.
> Double check your connection string to see if you have given enough time f
or
> sql connection (default is 15 sec) and sql command execution (default is 3
0
> sec).
> --
> -oj
>
> "Imtiaz" <Imtiaz@.discussions.microsoft.com> wrote in message
> news:F757C5B8-0EC9-4A09-888E-6A7282DFC922@.microsoft.com...
>
>

ASP Data Grid Needed

I need to display data from a sql server 2000 db on an asp web page and I need a vertical split. Does anyone have any solutions? I really can't afford to spend much/any money so freeware/shareware or coding suggestions is what I am interested in.
Thanks!What do you mean by vertical split?

Did you try GotDotNet.com?

Sorry im windows not much with asp|||Would TrueDBGrid do it for you?sql

ASP Connection String To SQL Server

Hi
This is new to me.
I am trying to connect an asp page to sql server.
Any help would be gratefully appreciated
I get the error message:
Technical Information (for support personnel)
a.. Error Type:
Microsoft VBScript runtime (0x800A01A8)
Object required: ''
/idataconnection.asp, line 10
b.. Browser Type:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.1.4322)
c.. Page:
GET /idataconnection.asp
The code I have in the page is:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
</head>
<body>
<%
oConn.Open "DSN=pubs;" & _
"Uid=testuser;" & _
"Pwd=123"
%>
</body>
</html>You have to first set oConn to a new instance of the ADODB connection
object.
"qqqq" <dddh@.ddd.clc> wrote in message
news:BW0Xb.4715$vo1.1496@.newsfep4-winn.server.ntli.net...
> Hi
> This is new to me.
> I am trying to connect an asp page to sql server.
> Any help would be gratefully appreciated
> I get the error message:
> Technical Information (for support personnel)
> a.. Error Type:
> Microsoft VBScript runtime (0x800A01A8)
> Object required: ''
> /idataconnection.asp, line 10
>
> b.. Browser Type:
> Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.1.4322)
> c.. Page:
> GET /idataconnection.asp
>
> The code I have in the page is:
> <html>
> <head>
> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
> <title>New Page 1</title>
> </head>
> <body>
> <%
> oConn.Open "DSN=pubs;" & _
> "Uid=testuser;" & _
> "Pwd=123"
> %>
> </body>
> </html>
>|||Hello,
try this
<%
set conn1=server.CreateObject("adodb.connection")
conn1.cursorlocation=3
conn1.Open "Provider=sqloledb;" & _
"Data Source=DB;" & _
"Initial Catalog=ayaz;" & _
"User Id=ayaz;" & _
"Password=ayaz"
%>
Thanks,
Warm Regards,
Ayaz Ahmed
Software Engineer & Web Developer
Creative Chaos (Pvt.) Ltd.
"Managing Your Digital Risk"
http://www.csquareonline.com
Karachi, Pakistan
Mobile +92 300 2280950
Office +92 21 455 2414
*** Sent via Developersdex http://www.examnotes.net ***
Don't just participate in USENET...get rewarded for it!

ASP and SQL Server Problem

When using ASP to connect to SQL Server, if one computer connects to sql server the second computer receives page cannot be displayed until the first computer is done. I have SQL Server running on Windows 2003 and IIS running on Windows 2000. Any help would be greatly appreciated. Thanks

What is the ASP page doing? It might be that you are performing a query that locks the data so the other page has to wait until the first one is done.

Best regards,

Sami Samir

ASP and MSDE Connection Problems

Hello
I have a simple MSDE database set up on this local machine. I have a small
asp.net web page that tries to query the database and returns a list from
one of the columns. Nothing fancy, just trying to set it all up and get it
all working.
I get an error on the page when I run it.
Exception Details: System.Data.SqlClient.SqlException: Login failed for
user 'BBAISLEY\ASPNET'.
I assume this means that the user account isn't set up right, but I am not
telling it to use this account. I have the following connection string:
Dim connectionString As String = "server='BBAISLEY\MSDEBBAISLEY';
trusted_connection=true; database='music_cds'; user id=SQL;
password=xxxxxxxxxx;"
Can someone help me get this working? I would like to make a simple account
for all of my apps to use, don't really care what its called for now.
When I log in, I can only use the windows authencation method, so maybe my
MSDE instance isn't set for SQL passwords? How can I check this?
Thanks
Brett
You are using ASP.NET?
This is a common error as the applications default to using the ASPNET
account.
You have two choices:
1. Give access to the ASPNET account. (I dont think you want to do this
though).
2. Modify the AUTHENTICATION heading in the web.config file, & also the
virtual directory/site/directory property to only allow windows
authenticated users into the folder:
Under the AUTHENTICATION heading add:
<identity impersonate="true" />
Modify IIS to only allow windows authenticated users through...
Cheers,
James Goodman
"Brett Baisley" <baisley@.hotmail.com.REMOVETHIS> wrote in message
news:e$TLLgdLEHA.3292@.TK2MSFTNGP11.phx.gbl...
> Hello
> I have a simple MSDE database set up on this local machine. I have a small
> asp.net web page that tries to query the database and returns a list from
> one of the columns. Nothing fancy, just trying to set it all up and get it
> all working.
> I get an error on the page when I run it.
> Exception Details: System.Data.SqlClient.SqlException: Login failed for
> user 'BBAISLEY\ASPNET'.
> I assume this means that the user account isn't set up right, but I am not
> telling it to use this account. I have the following connection string:
> Dim connectionString As String = "server='BBAISLEY\MSDEBBAISLEY';
> trusted_connection=true; database='music_cds'; user id=SQL;
> password=xxxxxxxxxx;"
> Can someone help me get this working? I would like to make a simple
account
> for all of my apps to use, don't really care what its called for now.
> When I log in, I can only use the windows authencation method, so maybe my
> MSDE instance isn't set for SQL passwords? How can I check this?
> Thanks
> Brett
>
|||Whoops, I misread!
It looks like you do want to use the first suggestion I made.
By default, msde is only setup for Windows Authentication, rather than sql
authentication.
See this link for information on how to modify this:
http://support.microsoft.com/default...en-us%3B319930
http://support.microsoft.com/default...n-us%3BQ322336
Cheers,
James Goodman
"Brett Baisley" <baisley@.hotmail.com.REMOVETHIS> wrote in message
news:e$TLLgdLEHA.3292@.TK2MSFTNGP11.phx.gbl...
> Hello
> I have a simple MSDE database set up on this local machine. I have a small
> asp.net web page that tries to query the database and returns a list from
> one of the columns. Nothing fancy, just trying to set it all up and get it
> all working.
> I get an error on the page when I run it.
> Exception Details: System.Data.SqlClient.SqlException: Login failed for
> user 'BBAISLEY\ASPNET'.
> I assume this means that the user account isn't set up right, but I am not
> telling it to use this account. I have the following connection string:
> Dim connectionString As String = "server='BBAISLEY\MSDEBBAISLEY';
> trusted_connection=true; database='music_cds'; user id=SQL;
> password=xxxxxxxxxx;"
> Can someone help me get this working? I would like to make a simple
account
> for all of my apps to use, don't really care what its called for now.
> When I log in, I can only use the windows authencation method, so maybe my
> MSDE instance isn't set for SQL passwords? How can I check this?
> Thanks
> Brett
>
|||Ahh, that fixed it up. Thanks James
"James" <jamesATnorton-associates.co.ukREMOVE> wrote in message
news:e6GypgfLEHA.1644@.TK2MSFTNGP09.phx.gbl...[vbcol=seagreen]
> Whoops, I misread!
> It looks like you do want to use the first suggestion I made.
> By default, msde is only setup for Windows Authentication, rather than sql
> authentication.
> See this link for information on how to modify this:
> http://support.microsoft.com/default...en-us%3B319930
> http://support.microsoft.com/default...n-us%3BQ322336
>
> --
> Cheers,
> James Goodman
> "Brett Baisley" <baisley@.hotmail.com.REMOVETHIS> wrote in message
> news:e$TLLgdLEHA.3292@.TK2MSFTNGP11.phx.gbl...
small[vbcol=seagreen]
from[vbcol=seagreen]
it[vbcol=seagreen]
not[vbcol=seagreen]
> account
my
>

ASP ADO SQL Time Out

I am programing an asp web page using ado/sql. My query is timing
out. I was doing just fine when I wasnt doing an inner join. I test
an instance of the query (Using the inner join) in sql query and it
ran fine, but when I did the query in the web page it times out.
Any Suggestions
thanks
Kirk"Kirk" <Kirk.Mccann@.NAV-INTERNATIONAL.com> wrote in message
news:eeff0422.0401151918.48768a14@.posting.google.c om...
> I am programing an asp web page using ado/sql. My query is timing
> out. I was doing just fine when I wasnt doing an inner join. I test
> an instance of the query (Using the inner join) in sql query and it
> ran fine, but when I did the query in the web page it times out.
> Any Suggestions
> thanks
> Kirk

You don't give much information, but if your query works fine in QA, then I
would use Profiler to verify that the ASP page is sending the same query to
the server. Profiler should also show you how long the query takes to
execute on the server, so it may help to narrow the problem down to the ASP
side or the database side.

Simon

ASP 3.0 Record is getting saved twice.

Hello All,

I am facing this unusual error. In My ASP Page I am submitting the Page and after submitting the form I am calling another ASP page, which contains sql command to insert the record.

My Problem is when I am submitting the Form. Record is getting inserted twice with same values.

What is the cause of this problem as I am facing this problem in every form.

With Regards

Sunil Dutt

First off, you (almost certainly) need to include a UNIQUE constraint to avoid allowing a user interface inserting duplicate data. You probably have a identity value for a primary key.

Second, the fact that I had to say "probably" in the previous statement means we are going to need more information, perhaps code. The post might need to be moved to the ASP forums, but first step, code :)

|||

Setting the Primary key concept I had used but that solved the problem but the asp page shows the error. And for a User it seems as there was error and his record is not saved. I am pasting my Code here :

LoggerDataEntryForm.asp

<%@. Language=VBScript %>
<HTML>
<head>
<title>Inerface Services</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="CSS/New%20Folder.css" rel="stylesheet" type="text/css">
<link href="CSS/IntStyle.css" rel="stylesheet" type="text/css">
<script language="JavaScript" type="text/JavaScript">
<!--
function formSave()
{
alert('Saving Record');
var frm = document.getElementById("frmUser_Master");
frm.action = "User_MasterAction.asp";
document.getElementById("frmUser_Master").submit();
}
//-->
</script>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<form name="frmUser_Master" id="frmUser_Master" method="Post">
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="center" valign="top"><table width="650" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="left" valign="top" class="PageBkBorder"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="LogoBk"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="100" align="center"><img src="images/interface-logo.gif" width="65" height="86"></td>
<td align="left" class="HeadingName"><br>
Web Tracking</td>
</tr>
</table></td>
</tr>
<tr>
<td height="7" class="GreyLine"><img src="images/Spacer.gif" width="1" height="7"></td>
</tr>
<tr>
<td height="20" class="BlueLine"> <table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr align="center">
<td class="Toplinks"><a href="LogIssue.htm" class="Toplinks">Log
Issue</a></td>
<td width="7"><img src="images/Divider.gif" width="7" height="19"></td>
<td class="Toplinks"><a href="ListDetails.htm" class="Toplinks">View Issue</a></td>
<td width="7"><img src="images/Divider.gif" width="7" height="19"></td>
<td class="Toplinks"><a href="Summary.htm" class="Toplinks">Summary</a></td>
<td width="7"><img src="images/Divider.gif" width="7" height="19"></td>
<td class="Toplinks"><a href="OpenLastSavedIssue.htm" class="Toplinks">Open
Last Saved issue</a></td>
<td width="7"><img src="images/Divider.gif" width="7" height="19"></td>
<td class="Toplinks"><a href="LoggerDataEntryForm.htm" class="Toplinks">Register
Now! </a></td>
</tr>
</table></td>
</tr>
<tr>
<td height="300" align="center" valign="top">
<table width="100%" border="0" cellpadding="0" cellspacing="3">
<tr>
<td align="center"><table width="400" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="left" class="PageTitle">Logger Entry Form</td>
</tr>
<tr>
<td align="center" class="FormBk"><table border="0" cellpadding="0" cellspacing="3">
<tr>
<td class="LabelText">&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td width="100" class="LabelText">Name</td>
<td> <input id="txtName" name="txtName" type="text" class="FormText">
</td>
</tr>
<tr>
<td class="LabelText">Designation</td>
<td><input id="txtDesig" name="txtDesig" type="text" class="FormText"></td>
</tr>
<tr>
<td class="LabelText">ID No</td>
<td><input id="txtID" name="txtID" type="text" class="FormText"></td>
</tr>
<tr>
<td class="LabelText">Contact No</td>
<td><input id="txtPhoneNo" name="txtPhoneNo" type="text" class="FormText"></td>
</tr>
<tr>
<td height="21" class="LabelText">Mobile</td>
<td><input id="txtMblPhoneNo" name="txtMblPhoneNo" type="text" class="FormText"></td>
</tr>
<tr>
<td class="LabelText">Username <br>
(Email ID)</td>
<td><input id="txtEmailID" name="txtEmailID" type="text" class="FormText"></td>
</tr>
<tr>
<td class="LabelText">Password</td>
<td><input id="txtPwd" name="txtPwd" type="Password" class="FormText"></td>
</tr>
<tr>
<td class="LabelText">Conform Password</td>
<td><input id="txtConPwd" name="txtConPwd" type="Password" class="FormText"></td>
</tr>
<tr>
<td class="LabelText">Branch Details</td>
<td><table border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="SmallText">State</td>
</tr>
<tr>
<td><select name="cmbState">
<option selected>Select All</option>
<option>Andhra Pradesh </option>
<option>Arunachal Pradesh</option>
<option>Assam</option>
<option>Bihar</option>
<option>Chhattisgarh</option>
<option>Goa</option>
<option>Gujarat</option>
<option>Haryana</option>
<option>Himachal Pradesh</option>
<option>Jammu and Kashmir</option>
<option>Jharkhand</option>
<option>Karnataka</option>
<option>Kerala</option>
<option>Madhya Pradesh</option>
<option>Maharashtra</option>
<option>Manipur</option>
<option>Meghalaya</option>
<option>Mizoram</option>
<option>Nagaland</option>
<option>Orissa</option>
<option>Punjab</option>
<option>Rajasthan</option>
<option>Tamil Nadu</option>
<option>Tripura</option>
<option>Uttarakhand</option>
<option>Uttar Pradesh</option>
<option>West Bengal</option>
</select></td>
</tr>
</table></td>
</tr>
<tr>
<td class="LabelText">&nbsp;</td>
<td><table border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="SmallText">Area</td>
</tr>
<tr>
<td><select name="cmbArea">
<option selected>Select All</option>
<option value="klm1">klm1</option>
<option value="klm2">klm2</option>
<option value="klm3">klm3</option>
</select></td>
</tr>
</table></td>
</tr>
<tr>
<td class="LabelText">&nbsp;</td>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="SmallText">City</td>
</tr>
<tr>
<td><select name="cmbCity">
<option selected value="Select">Select</option>
<option selected value="Pune">Pune</option>
</select></td>
</tr>
</table></td>
</tr>
<tr>
<td class="LabelText">&nbsp;</td>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="SmallText">Branch</td>
</tr>
<tr>
<td><select name="cmbBranch">
<option selected>Select</option>
<option value="mhlm1">mhlm1</option>
<option value="mhlm2">mhlm2</option>
<option value="mhlm3">mhlm3</option>
<option value="mhlm4">mhlm4</option>
<option value="mhlm5">mhlm5</option>
</select></td>
</tr>
</table></td>
</tr>
<tr>
<td class="LabelText">&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td class="LabelText">&nbsp;</td>
<td><input type="submit" name="Submit" value="Submit" onclick=formSave();"></td>
</tr>
<tr>
<td class="LabelText">&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table></td>
</tr>
</table>

&nbsp;

</td>
</tr>
</table></td>
</tr>
<tr>
<td height="11" align="center" valign="top" class="LightBlue"><img src="images/Spacer.gif" width="1" height="10"></td>
</tr>
<tr>
<td align="center" valign="top" class="BlueLine">&nbsp;</td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table>
</form>
</body>
</HTML>

User_MasterAction.asp

<%@. Language=VBScript %>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<!--#include file="dbcon.asp"-->
</HEAD>
<BODY>
<%
dim user_name,user_designation,User_ID,User_PhoneNo,User_MobileNo,User_email,user_password,user_state,user_branch,user_area,user_city
Response.Write "Test"
user_name = Request.Form("txtName") 'Name
user_designation = Request.Form("txtDesig") 'Designation
User_PhoneNo = Request.Form("txtPhoneNo") 'Phone Number
User_MobileNo = Request.Form("txtMblPhoneNo") 'Mobile Number
User_email = Request.Form("txtEmailID") 'Email ID
user_password = Request.Form("txtPwd") 'Password
user_state = Request.Form("cmbState") 'State
user_branch = Request.Form("cmbBranch") 'Branch
user_area = Request.Form("cmbArea") 'Area
user_city = Request.Form("cmbCity") 'City

dim strSql
strSql = "EXEC SP_UserMaster '" & user_name &"'," & user_designation & ",-1,'" & User_PhoneNo &"','" & User_MobileNo & "','"
strSql = strSql & User_email & "','" & user_password &"','" & user_state & "','" & user_branch & "','"
strSql = strSql & user_area & "','" & user_city &"',1"

Set TBRs = Server.CreateObject("ADODB.RecordSet")
Dim NxtUserID
TBRs.Open strSql,objcon ',adOpenStatic,adLockReadOnly
'NxtUserID = TBRs("NxtUserID").Value
%>

User Registration is Done. <a href="LoggerDataEntryForm.asp">Go To User Registration</a>


</BODY>
</HTML>

Stored Procedure SP_UserMaster

CREATE Procedure SP_UserMaster
@.user_name varchar(100),
@.user_designation int,
@.User_ID int,
@.User_PhoneNo varchar(15),
@.User_MobileNo varchar(20),
@.User_email varchar(50),
@.user_password varchar(15),
@.user_state varchar(50),
@.user_branch varchar(50),
@.user_area varchar(50),
@.user_city varchar(50),
@.mode int

As

--@.mode = 0 Edit
--@.mode = 1 Add
--@.mode = 3 Delete

if @.mode = 1
begin
declare @.nextUserID int
select @.nextUserID=ISNull(max([User_ID]) ,0) + 1 from User_Master

Insert into User_Master ([user_name],user_designation,[User_ID],phone_no,mobile_no,email_id,password,state,branch,area,city)
Values
(@.user_name,@.user_designation,@.nextUserID,@.User_PhoneNo,@.User_MobileNo,@.User_email,@.user_password,@.user_state,@.user_branch,@.user_area,@.user_city)

select @.nextUserID as NxtUserID
end
if @.mode = 0
begin
update User_Master set
[user_name] = @.user_name,
user_designation = @.user_designation,
Phone_No = @.User_PhoneNo,
Mobile_No = @.User_MobileNo,
email_id = @.User_email,
[password] = @.user_password,
state = @.user_state,
branch = @.user_branch,
area = @.user_area,
city = @.user_city where [User_ID] = @.User_ID
end
if @.mode = 3
begin
update User_Master set [User_Status] = 3 where [User_ID] = @.User_ID
end
GO

|||Moved to data access forum. Perhaps someone there knows the answer.|||SP looks OK to me. I am suspecting that your page called twice and you get duplicated inserts because of it.|||I just started having the same problem. Were you able to find a solution?

*** edited to add ***

Figured it out. I had the exact same thing in my code, an input type of "submit" as well as an onclick event that also submitted the form. Once I changed the "submit" to a "button", I stopped getting the duplicates.|||

yes, the problem was because the Javascript function formSave is called from the submit button and in submitform the form is submitted again. So the form was getting submitted twice just comment the submit line of the javascript or call the Java Script function FormSave from the link instead of Submit Button.

Regards

Sunil Dutt

sql

ASP 3.0 Record is getting saved twice.

Hello All,

I am facing this unusual error. In My ASP Page I am submitting the Page and after submitting the form I am calling another ASP page, which contains sql command to insert the record.

My Problem is when I am submitting the Form. Record is getting inserted twice with same values.

What is the cause of this problem as I am facing this problem in every form.

With Regards

Sunil Dutt

First off, you (almost certainly) need to include a UNIQUE constraint to avoid allowing a user interface inserting duplicate data. You probably have a identity value for a primary key.

Second, the fact that I had to say "probably" in the previous statement means we are going to need more information, perhaps code. The post might need to be moved to the ASP forums, but first step, code :)

|||

Setting the Primary key concept I had used but that solved the problem but the asp page shows the error. And for a User it seems as there was error and his record is not saved. I am pasting my Code here :

LoggerDataEntryForm.asp

<%@. Language=VBScript %>
<HTML>
<head>
<title>Inerface Services</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="CSS/New%20Folder.css" rel="stylesheet" type="text/css">
<link href="CSS/IntStyle.css" rel="stylesheet" type="text/css">
<script language="JavaScript" type="text/JavaScript">
<!--
function formSave()
{
alert('Saving Record');
var frm = document.getElementById("frmUser_Master");
frm.action = "User_MasterAction.asp";
document.getElementById("frmUser_Master").submit();
}
//-->
</script>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<form name="frmUser_Master" id="frmUser_Master" method="Post">
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="center" valign="top"><table width="650" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="left" valign="top" class="PageBkBorder"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="LogoBk"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="100" align="center"><img src="images/interface-logo.gif" width="65" height="86"></td>
<td align="left" class="HeadingName"><br>
Web Tracking</td>
</tr>
</table></td>
</tr>
<tr>
<td height="7" class="GreyLine"><img src="images/Spacer.gif" width="1" height="7"></td>
</tr>
<tr>
<td height="20" class="BlueLine"> <table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr align="center">
<td class="Toplinks"><a href="LogIssue.htm" class="Toplinks">Log
Issue</a></td>
<td width="7"><img src="images/Divider.gif" width="7" height="19"></td>
<td class="Toplinks"><a href="ListDetails.htm" class="Toplinks">View Issue</a></td>
<td width="7"><img src="images/Divider.gif" width="7" height="19"></td>
<td class="Toplinks"><a href="Summary.htm" class="Toplinks">Summary</a></td>
<td width="7"><img src="images/Divider.gif" width="7" height="19"></td>
<td class="Toplinks"><a href="OpenLastSavedIssue.htm" class="Toplinks">Open
Last Saved issue</a></td>
<td width="7"><img src="images/Divider.gif" width="7" height="19"></td>
<td class="Toplinks"><a href="LoggerDataEntryForm.htm" class="Toplinks">Register
Now! </a></td>
</tr>
</table></td>
</tr>
<tr>
<td height="300" align="center" valign="top">
<table width="100%" border="0" cellpadding="0" cellspacing="3">
<tr>
<td align="center"><table width="400" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="left" class="PageTitle">Logger Entry Form</td>
</tr>
<tr>
<td align="center" class="FormBk"><table border="0" cellpadding="0" cellspacing="3">
<tr>
<td class="LabelText">&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td width="100" class="LabelText">Name</td>
<td> <input id="txtName" name="txtName" type="text" class="FormText">
</td>
</tr>
<tr>
<td class="LabelText">Designation</td>
<td><input id="txtDesig" name="txtDesig" type="text" class="FormText"></td>
</tr>
<tr>
<td class="LabelText">ID No</td>
<td><input id="txtID" name="txtID" type="text" class="FormText"></td>
</tr>
<tr>
<td class="LabelText">Contact No</td>
<td><input id="txtPhoneNo" name="txtPhoneNo" type="text" class="FormText"></td>
</tr>
<tr>
<td height="21" class="LabelText">Mobile</td>
<td><input id="txtMblPhoneNo" name="txtMblPhoneNo" type="text" class="FormText"></td>
</tr>
<tr>
<td class="LabelText">Username <br>
(Email ID)</td>
<td><input id="txtEmailID" name="txtEmailID" type="text" class="FormText"></td>
</tr>
<tr>
<td class="LabelText">Password</td>
<td><input id="txtPwd" name="txtPwd" type="Password" class="FormText"></td>
</tr>
<tr>
<td class="LabelText">Conform Password</td>
<td><input id="txtConPwd" name="txtConPwd" type="Password" class="FormText"></td>
</tr>
<tr>
<td class="LabelText">Branch Details</td>
<td><table border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="SmallText">State</td>
</tr>
<tr>
<td><select name="cmbState">
<option selected>Select All</option>
<option>Andhra Pradesh </option>
<option>Arunachal Pradesh</option>
<option>Assam</option>
<option>Bihar</option>
<option>Chhattisgarh</option>
<option>Goa</option>
<option>Gujarat</option>
<option>Haryana</option>
<option>Himachal Pradesh</option>
<option>Jammu and Kashmir</option>
<option>Jharkhand</option>
<option>Karnataka</option>
<option>Kerala</option>
<option>Madhya Pradesh</option>
<option>Maharashtra</option>
<option>Manipur</option>
<option>Meghalaya</option>
<option>Mizoram</option>
<option>Nagaland</option>
<option>Orissa</option>
<option>Punjab</option>
<option>Rajasthan</option>
<option>Tamil Nadu</option>
<option>Tripura</option>
<option>Uttarakhand</option>
<option>Uttar Pradesh</option>
<option>West Bengal</option>
</select></td>
</tr>
</table></td>
</tr>
<tr>
<td class="LabelText">&nbsp;</td>
<td><table border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="SmallText">Area</td>
</tr>
<tr>
<td><select name="cmbArea">
<option selected>Select All</option>
<option value="klm1">klm1</option>
<option value="klm2">klm2</option>
<option value="klm3">klm3</option>
</select></td>
</tr>
</table></td>
</tr>
<tr>
<td class="LabelText">&nbsp;</td>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="SmallText">City</td>
</tr>
<tr>
<td><select name="cmbCity">
<option selected value="Select">Select</option>
<option selected value="Pune">Pune</option>
</select></td>
</tr>
</table></td>
</tr>
<tr>
<td class="LabelText">&nbsp;</td>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="SmallText">Branch</td>
</tr>
<tr>
<td><select name="cmbBranch">
<option selected>Select</option>
<option value="mhlm1">mhlm1</option>
<option value="mhlm2">mhlm2</option>
<option value="mhlm3">mhlm3</option>
<option value="mhlm4">mhlm4</option>
<option value="mhlm5">mhlm5</option>
</select></td>
</tr>
</table></td>
</tr>
<tr>
<td class="LabelText">&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td class="LabelText">&nbsp;</td>
<td><input type="submit" name="Submit" value="Submit" onclick=formSave();"></td>
</tr>
<tr>
<td class="LabelText">&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table></td>
</tr>
</table>

&nbsp;

</td>
</tr>
</table></td>
</tr>
<tr>
<td height="11" align="center" valign="top" class="LightBlue"><img src="images/Spacer.gif" width="1" height="10"></td>
</tr>
<tr>
<td align="center" valign="top" class="BlueLine">&nbsp;</td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table>
</form>
</body>
</HTML>

User_MasterAction.asp

<%@. Language=VBScript %>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<!--#include file="dbcon.asp"-->
</HEAD>
<BODY>
<%
dim user_name,user_designation,User_ID,User_PhoneNo,User_MobileNo,User_email,user_password,user_state,user_branch,user_area,user_city
Response.Write "Test"
user_name = Request.Form("txtName") 'Name
user_designation = Request.Form("txtDesig") 'Designation
User_PhoneNo = Request.Form("txtPhoneNo") 'Phone Number
User_MobileNo = Request.Form("txtMblPhoneNo") 'Mobile Number
User_email = Request.Form("txtEmailID") 'Email ID
user_password = Request.Form("txtPwd") 'Password
user_state = Request.Form("cmbState") 'State
user_branch = Request.Form("cmbBranch") 'Branch
user_area = Request.Form("cmbArea") 'Area
user_city = Request.Form("cmbCity") 'City

dim strSql
strSql = "EXEC SP_UserMaster '" & user_name &"'," & user_designation & ",-1,'" & User_PhoneNo &"','" & User_MobileNo & "','"
strSql = strSql & User_email & "','" & user_password &"','" & user_state & "','" & user_branch & "','"
strSql = strSql & user_area & "','" & user_city &"',1"

Set TBRs = Server.CreateObject("ADODB.RecordSet")
Dim NxtUserID
TBRs.Open strSql,objcon ',adOpenStatic,adLockReadOnly
'NxtUserID = TBRs("NxtUserID").Value
%>

User Registration is Done. <a href="LoggerDataEntryForm.asp">Go To User Registration</a>


</BODY>
</HTML>

Stored Procedure SP_UserMaster

CREATE Procedure SP_UserMaster
@.user_name varchar(100),
@.user_designation int,
@.User_ID int,
@.User_PhoneNo varchar(15),
@.User_MobileNo varchar(20),
@.User_email varchar(50),
@.user_password varchar(15),
@.user_state varchar(50),
@.user_branch varchar(50),
@.user_area varchar(50),
@.user_city varchar(50),
@.mode int

As

--@.mode = 0 Edit
--@.mode = 1 Add
--@.mode = 3 Delete

if @.mode = 1
begin
declare @.nextUserID int
select @.nextUserID=ISNull(max([User_ID]) ,0) + 1 from User_Master

Insert into User_Master ([user_name],user_designation,[User_ID],phone_no,mobile_no,email_id,password,state,branch,area,city)
Values
(@.user_name,@.user_designation,@.nextUserID,@.User_PhoneNo,@.User_MobileNo,@.User_email,@.user_password,@.user_state,@.user_branch,@.user_area,@.user_city)

select @.nextUserID as NxtUserID
end
if @.mode = 0
begin
update User_Master set
[user_name] = @.user_name,
user_designation = @.user_designation,
Phone_No = @.User_PhoneNo,
Mobile_No = @.User_MobileNo,
email_id = @.User_email,
[password] = @.user_password,
state = @.user_state,
branch = @.user_branch,
area = @.user_area,
city = @.user_city where [User_ID] = @.User_ID
end
if @.mode = 3
begin
update User_Master set [User_Status] = 3 where [User_ID] = @.User_ID
end
GO

|||Moved to data access forum. Perhaps someone there knows the answer.|||SP looks OK to me. I am suspecting that your page called twice and you get duplicated inserts because of it.|||I just started having the same problem. Were you able to find a solution?

*** edited to add ***

Figured it out. I had the exact same thing in my code, an input type of "submit" as well as an onclick event that also submitted the form. Once I changed the "submit" to a "button", I stopped getting the duplicates.|||

yes, the problem was because the Javascript function formSave is called from the submit button and in submitform the form is submitted again. So the form was getting submitted twice just comment the submit line of the javascript or call the Java Script function FormSave from the link instead of Submit Button.

Regards

Sunil Dutt