Showing posts with label insert. Show all posts
Showing posts with label insert. Show all posts

Sunday, March 25, 2012

ASP, SQL Server and double insert...

hello,
I have a little (big?) problem with a software in ASP / SQL Server.
This is a demo of the problem:

ID= 12458 Data=21/01/2004 21:14:45 txt txt txt
ID= 12458 Data=21/01/2004 21:14:45 txt txt txt
ID= 12458 Data=21/01/2004 21:14:45 txt txt txt
ID= 12458 Data=21/01/2004 21:14:45 txt txt txt
ID= 12458 Data=21/01/2004 21:14:45 txt txt txt

So: I insert a record from my asp page but I find the same record for
more times... Why?"Fast" <falaweb@.yahoo.it> wrote in message
news:58f1ac75.0402240125.63d09a7c@.posting.google.c om...
> hello,
> I have a little (big?) problem with a software in ASP / SQL Server.
> This is a demo of the problem:
> ID= 12458 Data=21/01/2004 21:14:45 txt txt txt
> ID= 12458 Data=21/01/2004 21:14:45 txt txt txt
> ID= 12458 Data=21/01/2004 21:14:45 txt txt txt
> ID= 12458 Data=21/01/2004 21:14:45 txt txt txt
> ID= 12458 Data=21/01/2004 21:14:45 txt txt txt
> So: I insert a record from my asp page but I find the same record for
> more times... Why?

No idea.

It might help if you actually post code or something.

However, the fact that your table allows multiple rows of the same
information is bad. It indicates you don't have any sort of unique primary
key.|||falaweb@.yahoo.it (Fast) wrote in message news:<58f1ac75.0402240125.63d09a7c@.posting.google.com>...
> hello,
> I have a little (big?) problem with a software in ASP / SQL Server.
> This is a demo of the problem:
> ID= 12458 Data=21/01/2004 21:14:45 txt txt txt
> ID= 12458 Data=21/01/2004 21:14:45 txt txt txt
> ID= 12458 Data=21/01/2004 21:14:45 txt txt txt
> ID= 12458 Data=21/01/2004 21:14:45 txt txt txt
> ID= 12458 Data=21/01/2004 21:14:45 txt txt txt
> So: I insert a record from my asp page but I find the same record for
> more times... Why?

I have no idea what the problem is from the ASP side, but you may be
able to troubleshoot by using Profiler to trace the SQL actually sent
to the server from ASP. You may find that the ASP code is not doing
exactly what you think it is.

In addition, you should add a primary key to your table to prevent
duplicate rows being inserted.

Simon

Tuesday, March 20, 2012

ASP - Insert Multiple records

I wanna know how to insert all the records that is checked into my SQL Server.. BUT all the records inserted is the same except for one column in my SQL Server which is the 'Partner' column..All the records that is checked?
Please explain some more!|||Well... i have a webpage in ASP. It displays all the ringing tones on the particular tones.asp page. Currently there is no check box as I do not know how to implement the method..

Therefore what i mean is that all the ringtones (to insert as new record in db), I have to view one by one to insert.

What i want to know is the way on how to mass insert all the ringtones with just a single click on the button. Meaning that i checked a few check boxes, and click the button..

You know what i mean my fren..?

Hope you can help..|||BTW, its sort of like the HOTMAIL... where you checked some boxes and PUT INTO FOLDER.... bla bla bla..

But what i want now is checked my ringtones check boxes and click a button to insert as a new record in my DB..|||<%
If len(trim(Request.Form("mTones"))) > 0 Then
Dim SQLStmt, x
SQLStmt = ""
for x = 1 to request.form("mTones").count
SQLStmt = SQLStmt & "INSERT INTO kek (tone) VALUES('"request.form("mTones")(x) & "';"
next
conn.execute(SQLStmt)
end if
%>

<form methos=post action=tones.asp>
<input type=checkbox name="mTones" id="tone1">tone1
<input type=checkbox name="mTones" id="tone2">tone2
<input type=submit>
</form>sql

Saturday, February 25, 2012

articles about data access using System.Data.SqlClient namespace?

Aaarrgghhhhhhh, still searchin' for a nice step-by-step article to learn data access (all insert delete update commands) with the SQL Server .NET Data Provider found in [System.Data.SqlClient] namespace...

Can anyone plz help me to find it?these might help?
http://samples.gotdotnet.com/quickstart/howto/doc/adoplus/ADOPlusOverview.aspx
http://www.stylusinc.net/technology/microsoft/ado.shtml
http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemDataSqlClientSqlConnectionClassTopic.asp?frame=true
http://msdn.microsoft.com/data/downloads/samples/default.aspx

Also
Check out the Data Access Application Block for .NET, it creates a wrapper around SqlClient class for somewhat easier use.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnbda/html/daab-rm.asp

Monday, February 13, 2012

ARITHABORT and Indexed Views

I've just implemented indexed views to increase the performance of one of my
stored procedures. However,
it turns out that you cannot insert into a table that is referenced by an
index view unless the ARITHABORT is set to ON.
You cannot set it to ON inside the procedure. (see
http://support.microsoft.com/default.aspx?kbid=305333).
The recommendation from Microsoft is to turn this on from the
application. -- Unfortunately, I don't have control over that. I did find a
solution: "ALTER DATABASE nwind SET ARITHABORT ON".
I'm a little hesitant to use this in production, as many apps use this
particular database. Does anybody know of any potential gotchas? It seems
to me that if my apps were generating divide-by-zero or overflow errors,
they wouldn't be working anyway.The chances of this causing a problem are pretty slim but you should try it
on a backup copy of the database to make sure there aren't some unforeseen
issues.
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
"MAS" <mark_stricker@.hotmail.com> wrote in message
news:eKGlalNLGHA.2392@.TK2MSFTNGP09.phx.gbl...
> I've just implemented indexed views to increase the performance of one of
> my stored procedures. However,
> it turns out that you cannot insert into a table that is referenced by an
> index view unless the ARITHABORT is set to ON.
> You cannot set it to ON inside the procedure. (see
> http://support.microsoft.com/default.aspx?kbid=305333).
> The recommendation from Microsoft is to turn this on from the
> application. -- Unfortunately, I don't have control over that. I did find
> a solution: "ALTER DATABASE nwind SET ARITHABORT ON".
> I'm a little hesitant to use this in production, as many apps use this
> particular database. Does anybody know of any potential gotchas? It
> seems to me that if my apps were generating divide-by-zero or overflow
> errors, they wouldn't be working anyway.
>
>

ARITHABORT

I have problem with indexed view:
SELECT failed because the following SET options have incorrect settings:
'ARITHABORT'
When insert, also some other options could affects.
I can't change the server properties for all required options because it
affects also other databases which are not mine.
Is there any way to set this option for my connection?
Maybe on SQL or on ado object?
I don't won't to put in each procedure and view the following statement:
SET
ARITHABORT,ANSI_NULLS,ANSI_PADDING,ANSI_
WARNINGS,CONCAT_NULL_YIELDS_NULL,QUO
TED_IDENTIFIERS
ON
SET NUMERIC_ROUNDABORT OFF
Regards,SimonYou can set some of these as default options per database (ALTER DATABASE).
But many of those are
largely useless, as many APIs (mostly the modern APIs) will override the ser
ver/database setting
anyhow. So you can set these setting when you connect from your app. But if
you use connection
pooling, these settings will be reset anyhow when a connection is re-used (G
oogle for
sp_reset_connection). It is possible that your API has option to set these s
ettings, but we'd need
to know what API you are using to tell that (or, rather, search the document
ation for the API).
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"simonZ" <simon.zupan@.studio-moderna.com> wrote in message
news:ublg22peGHA.3808@.TK2MSFTNGP02.phx.gbl...
>I have problem with indexed view:
> SELECT failed because the following SET options have incorrect settings: '
ARITHABORT'
> When insert, also some other options could affects.
> I can't change the server properties for all required options because it a
ffects also other
> databases which are not mine.
> Is there any way to set this option for my connection?
> Maybe on SQL or on ado object?
> I don't won't to put in each procedure and view the following statement:
> SET ARITHABORT,ANSI_NULLS,ANSI_PADDING,ANSI_
WARNINGS,CONCAT_NULL_YIELDS_NU
LL,QUOTED_IDENTIFIERS ON
> SET NUMERIC_ROUNDABORT OFF
> Regards,Simon
>

ARITHABORT

Help!!!
When attempting an insert to a table in SQL I get a message indicating that
the ARITHABORT setting is incorrect. Running (select databasepropertyex db,
'isarithabortenabled') returns null.
Running (alter database 'db' set arithabort off) doesn't change the setting.
I've tried setting it on and off, but the check always returns NULL.
Isn't there someway to set this value to 0 directly?
If anyone can help me I'd truly appreciate it. The table affected is the
primary table in the database and therefore, my db system is DOWN and
inoperable!!
Thanks.
Ross
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.592 / Virus Database: 375 - Release Date: 2/18/2004Try:
SELECT DATABASEPROPERTYEX('MyDatabase', 'IsArithmeticAbortEnabled')
Note that ARITHABORT must be *ON* when updating a table with an indexed view
or index on computed column.
Hope this helps.
Dan Guzman
SQL Server MVP
"Ross Culver" <rculver@.alliant-solutions.com> wrote in message
news:Ox%235GRW$DHA.3804@.TK2MSFTNGP09.phx.gbl...
> Help!!!
> When attempting an insert to a table in SQL I get a message indicating
that
> the ARITHABORT setting is incorrect. Running (select databasepropertyex
db,
> 'isarithabortenabled') returns null.
> Running (alter database 'db' set arithabort off) doesn't change the
setting.
> I've tried setting it on and off, but the check always returns NULL.
> Isn't there someway to set this value to 0 directly?
> If anyone can help me I'd truly appreciate it. The table affected is the
> primary table in the database and therefore, my db system is DOWN and
> inoperable!!
> Thanks.
> Ross
>
> --
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.592 / Virus Database: 375 - Release Date: 2/18/2004
>

ARITHABORT

Help!!!
When attempting an insert to a table in SQL I get a message indicating that
the ARITHABORT setting is incorrect. Running (select databasepropertyex db,
'isarithabortenabled') returns null.
Running (alter database 'db' set arithabort off) doesn't change the setting.
I've tried setting it on and off, but the check always returns NULL.
Isn't there someway to set this value to 0 directly?
If anyone can help me I'd truly appreciate it. The table affected is the
primary table in the database and therefore, my db system is DOWN and
inoperable!!
Thanks.
Ross
--
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.592 / Virus Database: 375 - Release Date: 2/18/2004Try:
SELECT DATABASEPROPERTYEX('MyDatabase', 'IsArithmeticAbortEnabled')
Note that ARITHABORT must be *ON* when updating a table with an indexed view
or index on computed column.
--
Hope this helps.
Dan Guzman
SQL Server MVP
"Ross Culver" <rculver@.alliant-solutions.com> wrote in message
news:Ox%235GRW$DHA.3804@.TK2MSFTNGP09.phx.gbl...
> Help!!!
> When attempting an insert to a table in SQL I get a message indicating
that
> the ARITHABORT setting is incorrect. Running (select databasepropertyex
db,
> 'isarithabortenabled') returns null.
> Running (alter database 'db' set arithabort off) doesn't change the
setting.
> I've tried setting it on and off, but the check always returns NULL.
> Isn't there someway to set this value to 0 directly?
> If anyone can help me I'd truly appreciate it. The table affected is the
> primary table in the database and therefore, my db system is DOWN and
> inoperable!!
> Thanks.
> Ross
>
> --
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.592 / Virus Database: 375 - Release Date: 2/18/2004
>