|
Absolutely.
Pictures of the menu available at the drive-thru
|
|
|
|
|
I just switched to Visual Studio 2005 so the answer to this maybe easy. I am working on a web application that retrieves Data from a SQL 2000 server. The sql statement takes between 25 and 40 seconds to execute and runs fine in SQL Analyzer. However, it times out in the application until you do a preview Data from the table adapter. Once you successfully get the data to retrieve by testing the table adapter the application works for a while. I have the connection timeout set for 900 in the connection string. Under Tools > Options > Database Tools > I have the cancel long query selection unchecked. It seems that the connection times out at 30 seconds no matter what you set it for.
In Visual Studio 2003 you could set the SQLDataAdapter connection time. In VS 2005 there does not seem to be a setting for that.
Data Source=PSY133;Initial Catalog=WindoPath;Integrated Security=True;Connect Timeout=900
GTWebb
IT System Manager
gtwebb@coastalpath.com
|
|
|
|
|
There are two timeouts. The Connection Timeout is the length of time that you are prepared to wait for it to connect to the database (not do any work). You are looking for the Command Timeout which defines the length of time that the command can take. By default it is set at 30 seconds. You need to change the CommandTimeout on the SqlCommand object you are using.
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|
|
Thanks for guiding me in the right direction. I still have another problem. When I create a partial class to adjust the command timeout.
The _commandCollection and _adapter are always null.
namespace mdsTableAdapters
{
public partial class MedDiagTableTableAdapter
{
public int SelectCommandTimeout
{
get
{
return (this._commandCollection[0].CommandTimeout);
}
set
{
for (int i = 0; i < this._commandCollection.Length; i++)
{
if ((this._commandCollection[i] != null))
{
((System.Data.SqlClient.SqlCommand)
(this._commandCollection[i])).CommandTimeout = value;
}
}
}
}
}
}
|
|
|
|
|
What benefits are you getting from using a partial class in this instance?
GTWebb wrote: The _commandCollection and _adapter are always null.
Do you ever initialise them somewhere? You don't show that code so I can't see what could be wrong.
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|
|
I'm using a partial class because that is the only way to get to the CommandTimeout property. The _commandCollection and _adapter are already incorportated into the TableAdapter Class. From everything that I have read they do not need to be initialized.
Here is the project I was basing this from.
http://www.codeproject.com/csharp/TableAdaptrCommandTimeout.asp
|
|
|
|
|
To answer my own question. Although all the examples online use _commandCollection I used CommandCollection and it works mooooe butter.
|
|
|
|
|
Hello everybody could tell me how to restore my db after windows reinstallation?When i try it give me errore "RESTORE DATA BASE MUST BE USED IN SINGLE USER MODE WHEN tring to restor to master database.Restore datebase is terminating abnormally" how to solve it ??????????????
pleas help me ( ( (
-- modified at 3:42 Friday 14th April, 2006
|
|
|
|
|
|
I'm attempting to create a new table from and INSERT trigger on MSSQL Server.
I've tried the following with no luck...any help out there /
ALTER TRIGGER [TRG_INS_CLIENTS] ON [dbo].[Clients]
FOR INSERT
AS
DECLARE @ClientName VARCHAR(50)
SELECT @ClientName = ClientName+'_ParseTable' FROM inserted
CREATE TABLE @ClientName (
[PrimaryKey] [decimal](18, 0) IDENTITY (1, 1) NOT NULL PRIMARY KEY CLUSTERED,
[FieldName] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[Source] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[Target] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[Steps] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL
)
|
|
|
|
|
One possible solution:
CREATE TRIGGER TRG_INS_CLIENTS ON [dbo].[Clients]
FOR INSERT
AS
DECLARE @ClientName VARCHAR(50)
SELECT @ClientName = ClientName FROM inserted
EXEC('CREATE TABLE ' + @ClientName + '(
[PrimaryKey] [decimal](18, 0) IDENTITY (1, 1) NOT NULL PRIMARY KEY CLUSTERED,
[FieldName] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[Source] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[Target] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[Steps] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL )')
I'm assuming that your field name is ClientName. I'm not sure what +'_ParseTable' is. If it is the field name, then just put ClientName_ParseTable in the select.
Be careful with EXEC() - it opens a door to malicious code.
----------
There go my people. I must find out where they are going so I can lead them.
- Alexander Ledru-Rollin
|
|
|
|
|
Thanks ! I found another solution using sp_sqlexecute() but this one is more elligant.
|
|
|
|
|
Glad it helped. Here is some info on sp_sqlexec.
SQL Books Online
SQL Server 6.x
sp_sqlexec provided a convenient way for SQL Server database clients and servers to send a language statement of any format to an Open Data Services server application.
SQL Server 2000
Removed; no longer available. Remove all references to sp_sqlexec.
----------
There go my people. I must find out where they are going so I can lead them.
- Alexander Ledru-Rollin
|
|
|
|
|
Hi all,
In a test database I have two tables, which are joined on a primary key. In the first table, this key is an auto-incrementing field.
Can anyone tell me a SQL (ie generic) way of being able to insert records into the primary table, retrieve the Primary Key value and be able to use that in the secondary table to create a related record?
I have thought about using a second query to return the last record entered, hwoever this seems a bit ugly, and would be prone to error in a multi-user environment.
Thanks,
Martin.
|
|
|
|
|
Is the database SQL server 2000..?U can use the "@@identity" to retrieve the primary key of the last record entered..
|
|
|
|
|
At the moment it's Access - but it could be SQL Server, Oracle OR DB2 in the future
|
|
|
|
|
I don't think there is a way that is so generic that it could handle all that. Each database vendor uses a slightly different flavour of SQL. For example SQL Server 2000 is based roughly on ANSI SQL-92, whereas SQL Server 2005 is roughly based on ANSI SQL-99. Oracle will have its on proprietary features and ways of doing things, as will DB2 and so on.
You could try looking at an open source product called NHibernate[^] which has its own SQL varient which is then translated in to the specific flavour of SQL required by the back end database.
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|
|
|
Frank Kerrigan wrote: MS Enterprise Libraries offer a Db access layer support across different databases manufactures;
True, but not to the same extent as Hibernate, unless I missed something in the Enterprise Library documentation. Hibernate (and NHibernate) offers the ability to translate SQL into the various flavours. For example. In SQL Server you might have
SELECT TOP 10 * FROM MyTable , while in Oracle the equivalent (if I remember) is something like
SELECT * FROM MyTable LIMIT 10,0 NHibernate permits the developer to develop in their varient which is then translated to any of the supported vendors SQL Language varient with not much more effort that a change in a config file.
As far as I can see the Enterprise Library still requires that the developer write SQL against the varient used by the back end database system - so there will still be a lot of work to do to get it to work nicely with various database systems.
Frank Kerrigan wrote: Look where you want to go not where you don't want to crash.
Excellent advice. I remember from a skid driving course I did a few years ago something similar.
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|
|
Hi, I want to list all tables names in combobox. Can somebody write a code example. Thank you
|
|
|
|
|
select * from information_schema.tables where table_type='Base table'
-
बुरा जो देखण मै चला, बुरा न िमलया कोय,
जो मन खोजा आपणा तो मुझसे बुरा न कोय।
Translation
|
|
|
|
|
thank You
|
|
|
|
|
I want to write genric select statement in which i want to get the top 10 people fom the tabel based on their total marks column.
I am getting the result when i give
"select top 10 percent fom studentmarks"
But it is not working when i making the statement generic.
"select top @p persent from stiudentmarks"
I am using SQL server 2000
I want to run it on the same (i have already tried it on server 2005 it is working fine)
Please any body help me how to make it work on SQlserver 2000
Varmag
|
|
|
|
|
varmag wrote: I am using SQL server 2000
This feature is not supported on SQL Server 2000. It is a new feature introduced in SQL Server 2005.
varmag wrote: Please any body help me how to make it work on SQlserver 2000
You could use dynamic SQL and construct a string like this:
DECLARE @sql VARCHAR(1000);
SET @sql = 'select top '+CAST(@p AS VARCHAR(10))+' percent fom studentmarks';
EXEC(@sql)
However, be careful as dynamic SQL can be a source of SQL Injection Attacks. If @p is already an integer type then the code should be fine.
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
-- modified at 11:16 Thursday 13th April, 2006
|
|
|
|
|
Colin Angus Mackay wrote: However, be careful as dynamic SQL can be a source of SQL Injection Attacks
What is SqlInjection attack?
"Aim to go where U have never been B4 and Strive to achieve it"
http://groups.yahoo.com/subscribe/dotnetforfreshers
http://himabinduvejella.blogspot.com
|
|
|
|