Showing posts with label display. Show all posts
Showing posts with label display. Show all posts

Sunday, March 25, 2012

advice for storing reservation/booking date ranges...

I am building a small app that will display availability data for properties. I have a calendar that displays the dates for a whole year in month rows with each days colour representing the availability status, i.e. booked, on hold etc.

My question is about how to store these dates in the db. At the moment I have the table below:

TABLE Availability
[PropertyID] [int] NOT NULL ,
[StatusID] [tinyint] NOT NULL ,
[StartDate] [smalldatetime] NOT NULL ,
[EndDate] [smalldatetime] NOT NULL

I was planning on having four status's for any given date, unknown, available, on hold or booked.

Displaying the dates has proved pretty simple but updating availability means I would need to query the db to see if any of the dates overlapped, I would then have to add the new date range/status as well as change any date ranges that overlapped, either in the sp or in the code and this is what made me wonder if there was a better way.

Does this sound a reasonable approach? Any advice or pointers would be greatly appreciated, This is the first time I have had to store date ranges and I want to make sure I am doing it right.

Instead of an Availability table, I would think you'd want a Booked table. Assume the property is available and create records in the Booked table when it's booked or held. Don't create records if you'd have an overlap by doing so. If no record for a time frame, then it's available.

It seems the way you're doing it, you would have to create a record for every date for every property. That makes it tough to be more granular if you need to go to the hour or minute level.

|||

Yes, unfortunately I have to cater for users who are not keeping the calendar uptodate hence using both the unknown and available status.

The default will be unknown, so anything not in the table will be that status and then it is up to users to use the calendar to update the properties availability, so there are three status's, available, on-hold and booked. These three will be in the table.

I think I will proceed as is and see how I go...thanks for the input.

Sunday, March 11, 2012

Advanced Defaulting Data Parameters

I have to date parameters defaulted as follows:
startdate = dateadd("M",-1,Today())
enddate = today()
So it will display data for the past month from today. Now, what I
need is the following. I need a subscription to be sent out at the
start of the month (so June 1st would be the next one). I need it to
show all data for May (that's 31 days, so far this is doing 30 days).
So using this same logic, it will return May 2nd to May 31st. I need
it to return the first and last of the previous month.
ThanksThere is a great article on how to do date stuff in T-SQL that might help
with other ideas, as the functionally is the same in VB
http://www.databasejournal.com/features/mssql/article.php/3076421
Reeves
"Ayman" wrote:
> I have to date parameters defaulted as follows:
> startdate = dateadd("M",-1,Today())
> enddate = today()
> So it will display data for the past month from today. Now, what I
> need is the following. I need a subscription to be sent out at the
> start of the month (so June 1st would be the next one). I need it to
> show all data for May (that's 31 days, so far this is doing 30 days).
> So using this same logic, it will return May 2nd to May 31st. I need
> it to return the first and last of the previous month.
> Thanks
>|||Here's how to do it in T-SQL (you can add this as a little dataset into your
report) -- you'll have to adjust the string parsing in the nested select if
your server's date representation is not MMDDYYY, but it's got three parts
and they are all straightforward. The only exciting bit there is making
sure to account for the first month of the year when you put the date
together.
SELECT CAST(FirstOfLastMonth AS DATETIME) AS FirstOfPreviousMonth,
DATEADD(month,1,CAST(FirstOfLastMonth AS DATETIME))-1 AS LastOfPreviousMonth
FROM (
SELECT FirstOfLastMonth = CASE WHEN MONTH(GETDATE()) = 1 THEN '12'
ELSE CAST(MONTH(GETDATE()) -1 AS VARCHAR) END +
'/1/' +
CASE WHEN MONTH(GETDATE()) = 1 THEN CAST(YEAR(GETDATE())-1 AS VARCHAR)
ELSE CAST(YEAR(GETDATE()) AS VARCHAR) END) X
Here's the trick: get the first day of the last month first (that's the
nested select) because you know its day is always day #1 of that month.
Once you've done that, getting the *last* day of the previous month is
pretty easy, no matter how many days there are in the month! Just use
DATEADD to go forward one month from the first day, which you've already
derived, and then go back one day <g>. You are probably going to slap
yourself on the head when you read that <g>.
>L<
"Ayman" <aymantg@.gmail.com> wrote in message
news:1180453077.604629.38770@.o5g2000hsb.googlegroups.com...
>I have to date parameters defaulted as follows:
> startdate = dateadd("M",-1,Today())
> enddate = today()
> So it will display data for the past month from today. Now, what I
> need is the following. I need a subscription to be sent out at the
> start of the month (so June 1st would be the next one). I need it to
> show all data for May (that's 31 days, so far this is doing 30 days).
> So using this same logic, it will return May 2nd to May 31st. I need
> it to return the first and last of the previous month.
> Thanks
>|||On May 30, 6:52 pm, "Lisa Slater Nicholls" <l...@.spacefold.com> wrote:
> Here's how to do it in T-SQL (you can add this as a little dataset into your
> report) -- you'll have to adjust the string parsing in the nested select if
> your server's date representation is not MMDDYYY, but it's got three parts
> and they are all straightforward. The only exciting bit there is making
> sure to account for the first month of the year when you put the date
> together.
> SELECT CAST(FirstOfLastMonth AS DATETIME) AS FirstOfPreviousMonth,
> DATEADD(month,1,CAST(FirstOfLastMonth AS DATETIME))-1 AS LastOfPreviousMonth
> FROM (
> SELECT FirstOfLastMonth => CASE WHEN MONTH(GETDATE()) = 1 THEN '12'
> ELSE CAST(MONTH(GETDATE()) -1 AS VARCHAR) END +
> '/1/' +
> CASE WHEN MONTH(GETDATE()) = 1 THEN CAST(YEAR(GETDATE())-1 AS VARCHAR)
> ELSE CAST(YEAR(GETDATE()) AS VARCHAR) END) X
> Here's the trick: get the first day of the last month first (that's the
> nested select) because you know its day is always day #1 of that month.
> Once you've done that, getting the *last* day of the previous month is
> pretty easy, no matter how many days there are in the month! Just use
> DATEADD to go forward one month from the first day, which you've already
> derived, and then go back one day <g>. You are probably going to slap
> yourself on the head when you read that <g>.
> >L<
> "Ayman" <ayma...@.gmail.com> wrote in message
> news:1180453077.604629.38770@.o5g2000hsb.googlegroups.com...
> >I have to date parameters defaulted as follows:
> > startdate = dateadd("M",-1,Today())
> > enddate = today()
> > So it will display data for the past month from today. Now, what I
> > need is the following. I need a subscription to be sent out at the
> > start of the month (so June 1st would be the next one). I need it to
> > show all data for May (that's 31 days, so far this is doing 30 days).
> > So using this same logic, it will return May 2nd to May 31st. I need
> > it to return the first and last of the previous month.
> > Thanks
I took a slightly different approach but it worked great. I made two
data sets with the following code.
end of month dataset:
select dateadd(ms,-3,DATEADD(mm, DATEDIFF(mm,0,getdate() ), 0))
start of month dataset:
select DATEADD(mm, DATEDIFF(mm,0,getdate())-1, 0)
Under Report>Report Parameters I just used the query for the default
values. Since both scripts only return one value, there is nothing
else that can be defaulted for either of these parameters. Works
well, although the first day of the month only puts the date and not
the time, it does start from midnight though. Thanks for everyone's
help.|||>>I made two data sets with the following code.
You can definitely do that -- and I'm glad you have something that works out
for you!
FWIW I like to have a single dataset with a whole bunch of parameter values
in it for reference (IOW a dataset that always has one row, with each
parameter or configuration value expressed as a column. That way, if you
need a lot of them, you don't have a lot of little datasets littering
around, and you can add in more columns with (say) formatted versions for
display in the report header, without a lot of work.
For example -- most of what you see here is just used in the report title,
but it's convenient to make it available to the report this way:
SELECT CONVERT(VARCHAR,@.From,101) AS FromDate,
CONVERT(VARCHAR,@.To,101) AS ToDate,
Left(DateName(month,@.From),3) AS FromCMonth,
Left(DateName(month,@.To),3) AS ToCMonth,
DATEPART(quarter,@.From) AS FromQtr,
DATEPART(quarter,@.To) AS ToQtr,
CAST(DATEPART(year,@.From) AS VARCHAR(4)) + '-' +
DateName(week,@.From) AS FromWeek,
CAST(DATEPART(year,@.To) AS VARCHAR(4)) + '-' +
DateName(week,@.To) AS ToWeek
...just a personal style thing, but it works really well...
>L<
"Ayman" <aymantg@.gmail.com> wrote in message
news:1180613135.364413.119400@.q75g2000hsh.googlegroups.com...
> On May 30, 6:52 pm, "Lisa Slater Nicholls" <l...@.spacefold.com> wrote:
>> Here's how to do it in T-SQL (you can add this as a little dataset into
>> your
>> report) -- you'll have to adjust the string parsing in the nested select
>> if
>> your server's date representation is not MMDDYYY, but it's got three
>> parts
>> and they are all straightforward. The only exciting bit there is making
>> sure to account for the first month of the year when you put the date
>> together.
>> SELECT CAST(FirstOfLastMonth AS DATETIME) AS FirstOfPreviousMonth,
>> DATEADD(month,1,CAST(FirstOfLastMonth AS DATETIME))-1 AS
>> LastOfPreviousMonth
>> FROM (
>> SELECT FirstOfLastMonth =>> CASE WHEN MONTH(GETDATE()) = 1 THEN '12'
>> ELSE CAST(MONTH(GETDATE()) -1 AS VARCHAR) END +
>> '/1/' +
>> CASE WHEN MONTH(GETDATE()) = 1 THEN CAST(YEAR(GETDATE())-1 AS
>> VARCHAR)
>> ELSE CAST(YEAR(GETDATE()) AS VARCHAR) END) X
>> Here's the trick: get the first day of the last month first (that's the
>> nested select) because you know its day is always day #1 of that month.
>> Once you've done that, getting the *last* day of the previous month is
>> pretty easy, no matter how many days there are in the month! Just use
>> DATEADD to go forward one month from the first day, which you've already
>> derived, and then go back one day <g>. You are probably going to slap
>> yourself on the head when you read that <g>.
>> >L<
>> "Ayman" <ayma...@.gmail.com> wrote in message
>> news:1180453077.604629.38770@.o5g2000hsb.googlegroups.com...
>> >I have to date parameters defaulted as follows:
>> > startdate = dateadd("M",-1,Today())
>> > enddate = today()
>> > So it will display data for the past month from today. Now, what I
>> > need is the following. I need a subscription to be sent out at the
>> > start of the month (so June 1st would be the next one). I need it to
>> > show all data for May (that's 31 days, so far this is doing 30 days).
>> > So using this same logic, it will return May 2nd to May 31st. I need
>> > it to return the first and last of the previous month.
>> > Thanks
> I took a slightly different approach but it worked great. I made two
> data sets with the following code.
> end of month dataset:
> select dateadd(ms,-3,DATEADD(mm, DATEDIFF(mm,0,getdate() ), 0))
> start of month dataset:
> select DATEADD(mm, DATEDIFF(mm,0,getdate())-1, 0)
> Under Report>Report Parameters I just used the query for the default
> values. Since both scripts only return one value, there is nothing
> else that can be defaulted for either of these parameters. Works
> well, although the first day of the month only puts the date and not
> the time, it does start from midnight though. Thanks for everyone's
> help.
>

Tuesday, March 6, 2012

AdomdConnection permission problem

I am developing a Windows Form application. On one of the forms I display the results of a query to an Analysis Services database. I create the MDX command text by building a string.

Everything works, but users who do not have permission to access the database encounter and access error. I don't want to give all of the users permission to access the database. I want the application to use the credentials in the connection string. However, when I execute the AdomdCommand, it seems to be using the credentials of the logged on user instead of the "User ID" in the connection string.

How can I get the command to use the credentials in the connection string?

Dim cmdText As String = ""

Dim BdSalesBacklog As Decimal = 0

Dim oAdomdConnection As New AdomdConnection("Data Source=server;Catalog=PortalAnalytics;User ID=user;password=password")

Dim oAdomdCommand As AdomdCommand = New AdomdCommand()

Dim oAdomdReader As AdomdDataReader

Dim period As String = ddlPeriod.Items(0)

oAdomdCommand.CommandType = CommandType.Text

cmdText = "" & _

"SELECT " & _

"{ BNBTime.[" & period & "] } ON COLUMNS , " & _

"{ Measures.[Total Backlog Snapshot] } ON ROWS " & _

"FROM BNB "

oAdomdCommand.CommandText = cmdText

Try

oAdomdConnection.Open()

oAdomdCommand.Connection = oAdomdConnection

oAdomdReader = oAdomdCommand.ExecuteReader()

Catch ex As Exception

MessageBox.Show(Err.Description)

End Try

Do While oAdomdReader.Read()

BdSalesBacklog = oAdomdReader.GetDecimal(1)

Loop

oAdomdReader.Close()

oAdomdConnection.Close()

I called a developer friend of mine and he explained to me that SSAS requires the logged on user to have permissions in a Role in the AS database.

I created an AD group containing the users to whom I want to allow access, and I gave that group membership in a new AS Role. I assigned the role the permissions I wanted the users to have.

My application now works for all the users who need to run it.

Thanks

AdomdConnection permission problem

I am developing a Windows Form application. On one of the forms I display the results of a query to an Analysis Services database. I create the MDX command text by building a string.

Everything works, but users who do not have permission to access the database encounter and access error. I don't want to give all of the users permission to access the database. I want the application to use the credentials in the connection string. However, when I execute the AdomdCommand, it seems to be using the credentials of the logged on user instead of the "User ID" in the connection string.

How can I get the command to use the credentials in the connection string?

Dim cmdText As String = ""

Dim BdSalesBacklog As Decimal = 0

Dim oAdomdConnection As New AdomdConnection("Data Source=server;Catalog=PortalAnalytics;User ID=user;password=password")

Dim oAdomdCommand As AdomdCommand = New AdomdCommand()

Dim oAdomdReader As AdomdDataReader

Dim period As String = ddlPeriod.Items(0)

oAdomdCommand.CommandType = CommandType.Text

cmdText = "" & _

"SELECT " & _

"{ BNBTime.[" & period & "] } ON COLUMNS , " & _

"{ Measures.[Total Backlog Snapshot] } ON ROWS " & _

"FROM BNB "

oAdomdCommand.CommandText = cmdText

Try

oAdomdConnection.Open()

oAdomdCommand.Connection = oAdomdConnection

oAdomdReader = oAdomdCommand.ExecuteReader()

Catch ex As Exception

MessageBox.Show(Err.Description)

End Try

Do While oAdomdReader.Read()

BdSalesBacklog = oAdomdReader.GetDecimal(1)

Loop

oAdomdReader.Close()

oAdomdConnection.Close()

I called a developer friend of mine and he explained to me that SSAS requires the logged on user to have permissions in a Role in the AS database.

I created an AD group containing the users to whom I want to allow access, and I gave that group membership in a new AS Role. I assigned the role the permissions I wanted the users to have.

My application now works for all the users who need to run it.

Thanks

Saturday, February 25, 2012

ADODB DATE RETRIEVE PROBLEM

HI , I HAVE A BIG PROBLEM,
I TRY TO EXPLAIN YOU.
I HAVE MANY TABLE WHOSE CONTAIN DATETIME FIELDS ,
I DISPLAY THIS VALUE ON A ASP PAGE BY USING AN ADODB RECORDSET AND ADODB
COMMAND CALLING A STORED PROCEDURE.
WHEN THIS RECORDSET RETRIEVE DATA THE DATE VALUE IS VERY STRANGE, INFACT IN
THE TABLE BY USING "SQL QUERY ANALIZER I SEE 2004-10-10 14:34:45.613
AND IT'S OK, BUT ADODB RECORDSET RETRIEVE /10/aa 14.34.45, I DON'T KNOW WHY
OR WHAT CAN I DO.
CAN SOMEONE HELP ME?
TAHNK YOU
Gianni
Look at regional settings on your workstation.
Also , have you tried to use FORMAT function on client side to see the date
output in format that you want.
"GIANNI" <GIANNI@.discussions.microsoft.com> wrote in message
news:2A7D3B28-5399-482A-9710-A6DFBF1A0E9B@.microsoft.com...
> HI , I HAVE A BIG PROBLEM,
> I TRY TO EXPLAIN YOU.
> I HAVE MANY TABLE WHOSE CONTAIN DATETIME FIELDS ,
> I DISPLAY THIS VALUE ON A ASP PAGE BY USING AN ADODB RECORDSET AND ADODB
> COMMAND CALLING A STORED PROCEDURE.
> WHEN THIS RECORDSET RETRIEVE DATA THE DATE VALUE IS VERY STRANGE, INFACT
IN
> THE TABLE BY USING "SQL QUERY ANALIZER I SEE 2004-10-10 14:34:45.613
> AND IT'S OK, BUT ADODB RECORDSET RETRIEVE /10/aa 14.34.45, I DON'T KNOW
WHY
> OR WHAT CAN I DO.
> CAN SOMEONE HELP ME?
> TAHNK YOU
>
|||Hi Uri,
the regional settings are ok, infact thi problem appeared when i restored
windows 2000 file system on my server, this application work well for 1 Year.
Regarding the format function, i can't format the value because the
retrivved date is very strange and the function doesn't work.
I have 3 Asp Apllication now that when retrieve date value have this problem.
"Uri Dimant" wrote:

> Gianni
> Look at regional settings on your workstation.
> Also , have you tried to use FORMAT function on client side to see the date
> output in format that you want.
>
> "GIANNI" <GIANNI@.discussions.microsoft.com> wrote in message
> news:2A7D3B28-5399-482A-9710-A6DFBF1A0E9B@.microsoft.com...
> IN
> WHY
>
>
|||Hi
It seems to me that you have a different/version file system applied to the
server. What else?
"GIANNI" <GIANNI@.discussions.microsoft.com> wrote in message
news:F6529C7F-4103-4969-B13A-52CA8763EB8D@.microsoft.com...
> Hi Uri,
> the regional settings are ok, infact thi problem appeared when i restored
> windows 2000 file system on my server, this application work well for 1
Year.
> Regarding the format function, i can't format the value because the
> retrivved date is very strange and the function doesn't work.
> I have 3 Asp Apllication now that when retrieve date value have this
problem.[vbcol=seagreen]
> "Uri Dimant" wrote:
date[vbcol=seagreen]
ADODB[vbcol=seagreen]
INFACT[vbcol=seagreen]
KNOW[vbcol=seagreen]
|||Only this,
but I can't hunderstand if something is happen to the Adodb component,
or now is changed something in IIS , infact if i use ADODB in Visual Basic
and connect it with the same table and fields i haven't this kind of problem.
"GIANNI" wrote:

> HI , I HAVE A BIG PROBLEM,
> I TRY TO EXPLAIN YOU.
> I HAVE MANY TABLE WHOSE CONTAIN DATETIME FIELDS ,
> I DISPLAY THIS VALUE ON A ASP PAGE BY USING AN ADODB RECORDSET AND ADODB
> COMMAND CALLING A STORED PROCEDURE.
> WHEN THIS RECORDSET RETRIEVE DATA THE DATE VALUE IS VERY STRANGE, INFACT IN
> THE TABLE BY USING "SQL QUERY ANALIZER I SEE 2004-10-10 14:34:45.613
> AND IT'S OK, BUT ADODB RECORDSET RETRIEVE /10/aa 14.34.45, I DON'T KNOW WHY
> OR WHAT CAN I DO.
> CAN SOMEONE HELP ME?
> TAHNK YOU
>
|||Only this,
but I can't hunderstand if something is happen to the Adodb component,
or now is changed something in IIS , infact if i use ADODB in Visual Basic
and connect it with the same table and fields i haven't this kind of problem.
"Uri Dimant" wrote:

> Hi
> It seems to me that you have a different/version file system applied to the
> server. What else?
>
> "GIANNI" <GIANNI@.discussions.microsoft.com> wrote in message
> news:F6529C7F-4103-4969-B13A-52CA8763EB8D@.microsoft.com...
> Year.
> problem.
> date
> ADODB
> INFACT
> KNOW
>
>
|||Gianni,
it depends on what you are doing with the recordset/dataset, but you might
want to look at using the CONVERT function on this field/output paramenter
to convert to a varchar. The CONVERT function has an optional 3rd argument
which can be used to format the datetime. On the ASP page you can have a
label explaining the format as it will obviously be invariant on the locale
of the client machine. This way you have no locale issues on the SQL Server
box or the IIS server box.
HTH,
Paul Ibison (SQL Server MVP)
(recommended sql server 2000 replication book:
http://www.nwsu.com/0974973602p.html)
|||Thanks Paul,
I know that I Have to use the convert function,
the problem for me is that until 2 weeks ago the problem didn't exist on my
Server,
now i have to change all my ASp Applications and apply the convert function.
I hoped to solve the problem server side, and not to change all my Stored
Procedure.
However Thanks
"Paul Ibison" wrote:

> Gianni,
> it depends on what you are doing with the recordset/dataset, but you might
> want to look at using the CONVERT function on this field/output paramenter
> to convert to a varchar. The CONVERT function has an optional 3rd argument
> which can be used to format the datetime. On the ASP page you can have a
> label explaining the format as it will obviously be invariant on the locale
> of the client machine. This way you have no locale issues on the SQL Server
> box or the IIS server box.
> HTH,
> Paul Ibison (SQL Server MVP)
> (recommended sql server 2000 replication book:
> http://www.nwsu.com/0974973602p.html)
>
>

ADODB DATE RETRIEVE PROBLEM

HI , I HAVE A BIG PROBLEM,
I TRY TO EXPLAIN YOU.
I HAVE MANY TABLE WHOSE CONTAIN DATETIME FIELDS ,
I DISPLAY THIS VALUE ON A ASP PAGE BY USING AN ADODB RECORDSET AND ADODB
COMMAND CALLING A STORED PROCEDURE.
WHEN THIS RECORDSET RETRIEVE DATA THE DATE VALUE IS VERY STRANGE, INFACT IN
THE TABLE BY USING "SQL QUERY ANALIZER I SEE 2004-10-10 14:34:45.613
AND IT'S OK, BUT ADODB RECORDSET RETRIEVE /10/aa 14.34.45, I DON'T KNOW WHY
OR WHAT CAN I DO.
CAN SOMEONE HELP ME?
TAHNK YOUGianni
Look at regional settings on your workstation.
Also , have you tried to use FORMAT function on client side to see the date
output in format that you want.
"GIANNI" <GIANNI@.discussions.microsoft.com> wrote in message
news:2A7D3B28-5399-482A-9710-A6DFBF1A0E9B@.microsoft.com...
> HI , I HAVE A BIG PROBLEM,
> I TRY TO EXPLAIN YOU.
> I HAVE MANY TABLE WHOSE CONTAIN DATETIME FIELDS ,
> I DISPLAY THIS VALUE ON A ASP PAGE BY USING AN ADODB RECORDSET AND ADODB
> COMMAND CALLING A STORED PROCEDURE.
> WHEN THIS RECORDSET RETRIEVE DATA THE DATE VALUE IS VERY STRANGE, INFACT
IN
> THE TABLE BY USING "SQL QUERY ANALIZER I SEE 2004-10-10 14:34:45.613
> AND IT'S OK, BUT ADODB RECORDSET RETRIEVE /10/aa 14.34.45, I DON'T KNOW
WHY
> OR WHAT CAN I DO.
> CAN SOMEONE HELP ME?
> TAHNK YOU
>|||Hi Uri,
the regional settings are ok, infact thi problem appeared when i restored
windows 2000 file system on my server, this application work well for 1 Year.
Regarding the format function, i can't format the value because the
retrivved date is very strange and the function doesn't work.
I have 3 Asp Apllication now that when retrieve date value have this problem.
"Uri Dimant" wrote:
> Gianni
> Look at regional settings on your workstation.
> Also , have you tried to use FORMAT function on client side to see the date
> output in format that you want.
>
> "GIANNI" <GIANNI@.discussions.microsoft.com> wrote in message
> news:2A7D3B28-5399-482A-9710-A6DFBF1A0E9B@.microsoft.com...
> > HI , I HAVE A BIG PROBLEM,
> > I TRY TO EXPLAIN YOU.
> > I HAVE MANY TABLE WHOSE CONTAIN DATETIME FIELDS ,
> > I DISPLAY THIS VALUE ON A ASP PAGE BY USING AN ADODB RECORDSET AND ADODB
> > COMMAND CALLING A STORED PROCEDURE.
> > WHEN THIS RECORDSET RETRIEVE DATA THE DATE VALUE IS VERY STRANGE, INFACT
> IN
> > THE TABLE BY USING "SQL QUERY ANALIZER I SEE 2004-10-10 14:34:45.613
> > AND IT'S OK, BUT ADODB RECORDSET RETRIEVE /10/aa 14.34.45, I DON'T KNOW
> WHY
> > OR WHAT CAN I DO.
> > CAN SOMEONE HELP ME?
> > TAHNK YOU
> >
>
>|||Hi
It seems to me that you have a different/version file system applied to the
server. What else?
"GIANNI" <GIANNI@.discussions.microsoft.com> wrote in message
news:F6529C7F-4103-4969-B13A-52CA8763EB8D@.microsoft.com...
> Hi Uri,
> the regional settings are ok, infact thi problem appeared when i restored
> windows 2000 file system on my server, this application work well for 1
Year.
> Regarding the format function, i can't format the value because the
> retrivved date is very strange and the function doesn't work.
> I have 3 Asp Apllication now that when retrieve date value have this
problem.
> "Uri Dimant" wrote:
> > Gianni
> > Look at regional settings on your workstation.
> > Also , have you tried to use FORMAT function on client side to see the
date
> > output in format that you want.
> >
> >
> >
> > "GIANNI" <GIANNI@.discussions.microsoft.com> wrote in message
> > news:2A7D3B28-5399-482A-9710-A6DFBF1A0E9B@.microsoft.com...
> > > HI , I HAVE A BIG PROBLEM,
> > > I TRY TO EXPLAIN YOU.
> > > I HAVE MANY TABLE WHOSE CONTAIN DATETIME FIELDS ,
> > > I DISPLAY THIS VALUE ON A ASP PAGE BY USING AN ADODB RECORDSET AND
ADODB
> > > COMMAND CALLING A STORED PROCEDURE.
> > > WHEN THIS RECORDSET RETRIEVE DATA THE DATE VALUE IS VERY STRANGE,
INFACT
> > IN
> > > THE TABLE BY USING "SQL QUERY ANALIZER I SEE 2004-10-10 14:34:45.613
> > > AND IT'S OK, BUT ADODB RECORDSET RETRIEVE /10/aa 14.34.45, I DON'T
KNOW
> > WHY
> > > OR WHAT CAN I DO.
> > > CAN SOMEONE HELP ME?
> > > TAHNK YOU
> > >
> >
> >
> >|||Only this,
but I can't hunderstand if something is happen to the Adodb component,
or now is changed something in IIS , infact if i use ADODB in Visual Basic
and connect it with the same table and fields i haven't this kind of problem.
"GIANNI" wrote:
> HI , I HAVE A BIG PROBLEM,
> I TRY TO EXPLAIN YOU.
> I HAVE MANY TABLE WHOSE CONTAIN DATETIME FIELDS ,
> I DISPLAY THIS VALUE ON A ASP PAGE BY USING AN ADODB RECORDSET AND ADODB
> COMMAND CALLING A STORED PROCEDURE.
> WHEN THIS RECORDSET RETRIEVE DATA THE DATE VALUE IS VERY STRANGE, INFACT IN
> THE TABLE BY USING "SQL QUERY ANALIZER I SEE 2004-10-10 14:34:45.613
> AND IT'S OK, BUT ADODB RECORDSET RETRIEVE /10/aa 14.34.45, I DON'T KNOW WHY
> OR WHAT CAN I DO.
> CAN SOMEONE HELP ME?
> TAHNK YOU
>|||Only this,
but I can't hunderstand if something is happen to the Adodb component,
or now is changed something in IIS , infact if i use ADODB in Visual Basic
and connect it with the same table and fields i haven't this kind of problem.
"Uri Dimant" wrote:
> Hi
> It seems to me that you have a different/version file system applied to the
> server. What else?
>
> "GIANNI" <GIANNI@.discussions.microsoft.com> wrote in message
> news:F6529C7F-4103-4969-B13A-52CA8763EB8D@.microsoft.com...
> > Hi Uri,
> > the regional settings are ok, infact thi problem appeared when i restored
> > windows 2000 file system on my server, this application work well for 1
> Year.
> > Regarding the format function, i can't format the value because the
> > retrivved date is very strange and the function doesn't work.
> > I have 3 Asp Apllication now that when retrieve date value have this
> problem.
> >
> > "Uri Dimant" wrote:
> >
> > > Gianni
> > > Look at regional settings on your workstation.
> > > Also , have you tried to use FORMAT function on client side to see the
> date
> > > output in format that you want.
> > >
> > >
> > >
> > > "GIANNI" <GIANNI@.discussions.microsoft.com> wrote in message
> > > news:2A7D3B28-5399-482A-9710-A6DFBF1A0E9B@.microsoft.com...
> > > > HI , I HAVE A BIG PROBLEM,
> > > > I TRY TO EXPLAIN YOU.
> > > > I HAVE MANY TABLE WHOSE CONTAIN DATETIME FIELDS ,
> > > > I DISPLAY THIS VALUE ON A ASP PAGE BY USING AN ADODB RECORDSET AND
> ADODB
> > > > COMMAND CALLING A STORED PROCEDURE.
> > > > WHEN THIS RECORDSET RETRIEVE DATA THE DATE VALUE IS VERY STRANGE,
> INFACT
> > > IN
> > > > THE TABLE BY USING "SQL QUERY ANALIZER I SEE 2004-10-10 14:34:45.613
> > > > AND IT'S OK, BUT ADODB RECORDSET RETRIEVE /10/aa 14.34.45, I DON'T
> KNOW
> > > WHY
> > > > OR WHAT CAN I DO.
> > > > CAN SOMEONE HELP ME?
> > > > TAHNK YOU
> > > >
> > >
> > >
> > >
>
>|||Gianni,
it depends on what you are doing with the recordset/dataset, but you might
want to look at using the CONVERT function on this field/output paramenter
to convert to a varchar. The CONVERT function has an optional 3rd argument
which can be used to format the datetime. On the ASP page you can have a
label explaining the format as it will obviously be invariant on the locale
of the client machine. This way you have no locale issues on the SQL Server
box or the IIS server box.
HTH,
Paul Ibison (SQL Server MVP)
(recommended sql server 2000 replication book:
http://www.nwsu.com/0974973602p.html)|||Thanks Paul,
I know that I Have to use the convert function,
the problem for me is that until 2 weeks ago the problem didn't exist on my
Server,
now i have to change all my ASp Applications and apply the convert function.
I hoped to solve the problem server side, and not to change all my Stored
Procedure.
However Thanks
"Paul Ibison" wrote:
> Gianni,
> it depends on what you are doing with the recordset/dataset, but you might
> want to look at using the CONVERT function on this field/output paramenter
> to convert to a varchar. The CONVERT function has an optional 3rd argument
> which can be used to format the datetime. On the ASP page you can have a
> label explaining the format as it will obviously be invariant on the locale
> of the client machine. This way you have no locale issues on the SQL Server
> box or the IIS server box.
> HTH,
> Paul Ibison (SQL Server MVP)
> (recommended sql server 2000 replication book:
> http://www.nwsu.com/0974973602p.html)
>
>

ADODB DATE RETRIEVE PROBLEM

HI , I HAVE A BIG PROBLEM,
I TRY TO EXPLAIN YOU.
I HAVE MANY TABLE WHOSE CONTAIN DATETIME FIELDS ,
I DISPLAY THIS VALUE ON A ASP PAGE BY USING AN ADODB RECORDSET AND ADODB
COMMAND CALLING A STORED PROCEDURE.
WHEN THIS RECORDSET RETRIEVE DATA THE DATE VALUE IS VERY STRANGE, INFACT IN
THE TABLE BY USING "SQL QUERY ANALIZER I SEE 2004-10-10 14:34:45.613
AND IT'S OK, BUT ADODB RECORDSET RETRIEVE /10/aa 14.34.45, I DON'T KNOW WHY
OR WHAT CAN I DO.
CAN SOMEONE HELP ME?
TAHNK YOUGianni
Look at regional settings on your workstation.
Also , have you tried to use FORMAT function on client side to see the date
output in format that you want.
"GIANNI" <GIANNI@.discussions.microsoft.com> wrote in message
news:2A7D3B28-5399-482A-9710-A6DFBF1A0E9B@.microsoft.com...
> HI , I HAVE A BIG PROBLEM,
> I TRY TO EXPLAIN YOU.
> I HAVE MANY TABLE WHOSE CONTAIN DATETIME FIELDS ,
> I DISPLAY THIS VALUE ON A ASP PAGE BY USING AN ADODB RECORDSET AND ADODB
> COMMAND CALLING A STORED PROCEDURE.
> WHEN THIS RECORDSET RETRIEVE DATA THE DATE VALUE IS VERY STRANGE, INFACT
IN
> THE TABLE BY USING "SQL QUERY ANALIZER I SEE 2004-10-10 14:34:45.613
> AND IT'S OK, BUT ADODB RECORDSET RETRIEVE /10/aa 14.34.45, I DON'T KNOW
WHY
> OR WHAT CAN I DO.
> CAN SOMEONE HELP ME?
> TAHNK YOU
>|||Hi Uri,
the regional settings are ok, infact thi problem appeared when i restored
windows 2000 file system on my server, this application work well for 1 Year
.
Regarding the format function, i can't format the value because the
retrivved date is very strange and the function doesn't work.
I have 3 Asp Apllication now that when retrieve date value have this problem
.
"Uri Dimant" wrote:

> Gianni
> Look at regional settings on your workstation.
> Also , have you tried to use FORMAT function on client side to see the da
te
> output in format that you want.
>
> "GIANNI" <GIANNI@.discussions.microsoft.com> wrote in message
> news:2A7D3B28-5399-482A-9710-A6DFBF1A0E9B@.microsoft.com...
> IN
> WHY
>
>|||Hi
It seems to me that you have a different/version file system applied to the
server. What else?
"GIANNI" <GIANNI@.discussions.microsoft.com> wrote in message
news:F6529C7F-4103-4969-B13A-52CA8763EB8D@.microsoft.com...
> Hi Uri,
> the regional settings are ok, infact thi problem appeared when i restored
> Windows 2000 file system on my server, this application work well for 1
Year.
> Regarding the format function, i can't format the value because the
> retrivved date is very strange and the function doesn't work.
> I have 3 Asp Apllication now that when retrieve date value have this
problem.[vbcol=seagreen]
> "Uri Dimant" wrote:
>
date[vbcol=seagreen]
ADODB[vbcol=seagreen]
INFACT[vbcol=seagreen]
KNOW[vbcol=seagreen]|||Only this,
but I can't hunderstand if something is happen to the Adodb component,
or now is changed something in IIS , infact if i use ADODB in Visual Basic
and connect it with the same table and fields i haven't this kind of problem
.
"GIANNI" wrote:

> HI , I HAVE A BIG PROBLEM,
> I TRY TO EXPLAIN YOU.
> I HAVE MANY TABLE WHOSE CONTAIN DATETIME FIELDS ,
> I DISPLAY THIS VALUE ON A ASP PAGE BY USING AN ADODB RECORDSET AND ADODB
> COMMAND CALLING A STORED PROCEDURE.
> WHEN THIS RECORDSET RETRIEVE DATA THE DATE VALUE IS VERY STRANGE, INFACT I
N
> THE TABLE BY USING "SQL QUERY ANALIZER I SEE 2004-10-10 14:34:45.613
> AND IT'S OK, BUT ADODB RECORDSET RETRIEVE /10/aa 14.34.45, I DON'T KNOW W
HY
> OR WHAT CAN I DO.
> CAN SOMEONE HELP ME?
> TAHNK YOU
>|||Only this,
but I can't hunderstand if something is happen to the Adodb component,
or now is changed something in IIS , infact if i use ADODB in Visual Basic
and connect it with the same table and fields i haven't this kind of problem
.
"Uri Dimant" wrote:

> Hi
> It seems to me that you have a different/version file system applied to th
e
> server. What else?
>
> "GIANNI" <GIANNI@.discussions.microsoft.com> wrote in message
> news:F6529C7F-4103-4969-B13A-52CA8763EB8D@.microsoft.com...
> Year.
> problem.
> date
> ADODB
> INFACT
> KNOW
>
>|||Gianni,
it depends on what you are doing with the recordset/dataset, but you might
want to look at using the CONVERT function on this field/output paramenter
to convert to a varchar. The CONVERT function has an optional 3rd argument
which can be used to format the datetime. On the ASP page you can have a
label explaining the format as it will obviously be invariant on the locale
of the client machine. This way you have no locale issues on the SQL Server
box or the IIS server box.
HTH,
Paul Ibison (SQL Server MVP)
(recommended sql server 2000 replication book:
http://www.nwsu.com/0974973602p.html)|||Thanks Paul,
I know that I Have to use the convert function,
the problem for me is that until 2 weeks ago the problem didn't exist on my
Server,
now i have to change all my ASp Applications and apply the convert function.
I hoped to solve the problem server side, and not to change all my Stored
Procedure.
However Thanks
"Paul Ibison" wrote:

> Gianni,
> it depends on what you are doing with the recordset/dataset, but you might
> want to look at using the CONVERT function on this field/output paramenter
> to convert to a varchar. The CONVERT function has an optional 3rd argument
> which can be used to format the datetime. On the ASP page you can have a
> label explaining the format as it will obviously be invariant on the local
e
> of the client machine. This way you have no locale issues on the SQL Serve
r
> box or the IIS server box.
> HTH,
> Paul Ibison (SQL Server MVP)
> (recommended sql server 2000 replication book:
> http://www.nwsu.com/0974973602p.html)
>
>

Adobe Acrobat 8 vs. RS 2005 PDF Rendering

For the last two years I've had an application running in production which would generate and display its reports as PDF via RS 2005. It would take user parameters, render the report, and my application would take the PDF bytestream from RS and save it to a file on disk, then request Windows to open the file. This has worked very smoothly.

Recently there has been a push in my company to get Adobe Acrobat 8 deployed, and apparently the same PDFs which have been working all this time will cause Acrobat 8 to choke. By choke, I mean that Acrobat will load into memory but have some sort of problem with the PDFs, and never show up. The users, not realizing what is going on, will then ask for the same report again, causing two stalled instances of Acrobat to be opened now, etc.

Removing the new acrobat and replacing it with Acrobat 7 solves the problem. Long term, this is not a good solution however... Has anyone else had a similar experience? I've googled around and have come up empty.

I've seen Acrobat 8 act that when it cannot communicate properly with the Adobe updater. On a client that is experiencing that behavior, can you launch Acrobat 8 and manually ensure it is up-to-date?

Thanks.

|||Thanks Donovan,
I've passed this on to our tech support guys and will be doing a test later today myself on one of our spare workstations. I should be able to replicate the issue our users have seen - at which point I'll play with the Acrobat update options and determine whether they are the cause. I'll post a follow-up comment to this thread with the results.

Friday, February 24, 2012

Ado Xml

Im getting an XML String from the server which I load into an ADO Recordset for display.
Im use the XMLDomDocumentPtr
and then use ADO Recordset.Open method for the XMLDocument.

All this works fine. The only problem i have is it is very slow. It takes 2seconds for just 1000 records which is not good.

Any help is appreciated...My experience with large recordsets mirrors yours; it does get slow (though I generally began experiencing issues at around 10,000 records). The data is being loaded into an object resident in memory. I usually stick to this technique when recordsets are smaller than 1,000 rows.

Regards,

hmscott|||My first observation would have to be that if you are returning rows for the user to peruse, what are the chances that they'll actually look at more than ten? While recordsets can be huge, my users rarely care about sets with more than twelve rows, and never care about more than 25, so a limit of a thousand seems silly to me!

Next order of business is data size... XML tends to produce largish rows, often in the 2Kb to 10 Kb range. If you figure out how much data that amounts to for a thousand rows, your application is having to slog through quite a bit of data, and that data is often coming down a relatively slow line. If this is your case, just moving and reformatting the data takes a while.

While you might be an exception to the rule and have a perfectly valid reason to do what you are doing, nearly every case I've seen where someone complains about performance for this kind of thing has hinged on a design flaw. Please examine what you are doing, and the performance you are complaining about, and if the problem isn't apparent please give more details and I'm sure that someone here can offer you suggestions.

-PatP

Sunday, February 19, 2012

ADO Recordset result cannot display Chinese

Hi all,
I have created an application that get Chinese data from SQL Server 2000.
I am using ActiveX Data Object 2.5 via ODBC as connection. Most PC work
perfectly. However, there is 1 client PC that cannot display Chinese. It
always show ?. Can anyone give me some tips?
Regards,
Edward HuiIs this a unicode capable client (what version of windows?) with recent
versions of ODBC drivers?
"Edward Hui" <edhui@.asl.com.hk> wrote in message
news:OaUWhmz2DHA.1760@.TK2MSFTNGP10.phx.gbl...
quote:

> Hi all,
> I have created an application that get Chinese data from SQL Server

2000.
quote:

> I am using ActiveX Data Object 2.5 via ODBC as connection. Most PC work
> perfectly. However, there is 1 client PC that cannot display Chinese. It
> always show ?. Can anyone give me some tips?
> Regards,
> Edward Hui
>

ADO query restricting to SELECT

Hi,
Can I restrict INSERT, DELETE, UPDATE, INTO queries in ADO? I get the
query as input from user. Run it using ADO connection. Display the result in
grid. However I want to allow only SELECT queries. Is there a property on
ADO which allows this? Otherwise I will have to do the parsing myself.
Thanks in advance.
AjeyHi
You will need to restrict the access with permissions at table level. If you
allow them to write their own queries instead of using a controlled query
builder or stored procedures then you will need to do your own parsing.
You should also read up on SQL Injection such as
http://www.sqlsecurity.com/DesktopDefault.aspx?tabid=23
John
"Ajey" wrote:
> Hi,
> Can I restrict INSERT, DELETE, UPDATE, INTO queries in ADO? I get the
> query as input from user. Run it using ADO connection. Display the result in
> grid. However I want to allow only SELECT queries. Is there a property on
> ADO which allows this? Otherwise I will have to do the parsing myself.
> Thanks in advance.
> Ajey
>
>|||Hi,
By the post I understand that, u have a layee between the database and the
user.
The user need to send a select query and the result is displayed in the Grid.
The users are presently having a flexibility to send the any kind of query.
If they send INSERT, UPDATE or DELETE, your data will be currupted, and you
wante to restrict that.
If my prediction was correct, what I suggest you is, to use a Stored
Procedure for this purpose or open the ADO with read only permissions.
I believe this answered your question. please revert back if u have any issues
thanks and regards
Chandra
"Ajey" wrote:
> Hi,
> Can I restrict INSERT, DELETE, UPDATE, INTO queries in ADO? I get the
> query as input from user. Run it using ADO connection. Display the result in
> grid. However I want to allow only SELECT queries. Is there a property on
> ADO which allows this? Otherwise I will have to do the parsing myself.
> Thanks in advance.
> Ajey
>
>|||Thanks.
Yes, that's what i want to do.
And also I want to prevent sql-injection. Thanks John.
I want to restrict the query to SELECT. I even if the user has permissions
to modify the table I don't want him to alter it through the query.
How can I open ADO with read only permissons?
Thanks in advance.
Ajey
"Chandra" <Chandra@.discussions.microsoft.com> wrote in message
news:CF97CE16-EFCF-4212-811C-A8C95E28D03E@.microsoft.com...
> Hi,
> By the post I understand that, u have a layee between the database and the
> user.
> The user need to send a select query and the result is displayed in the
Grid.
> The users are presently having a flexibility to send the any kind of
query.
> If they send INSERT, UPDATE or DELETE, your data will be currupted, and
you
> wante to restrict that.
> If my prediction was correct, what I suggest you is, to use a Stored
> Procedure for this purpose or open the ADO with read only permissions.
> I believe this answered your question. please revert back if u have any
issues
> thanks and regards
> Chandra
>
> "Ajey" wrote:
> > Hi,
> > Can I restrict INSERT, DELETE, UPDATE, INTO queries in ADO? I get
the
> > query as input from user. Run it using ADO connection. Display the
result in
> > grid. However I want to allow only SELECT queries. Is there a property
on
> > ADO which allows this? Otherwise I will have to do the parsing myself.
> >
> > Thanks in advance.
> > Ajey
> >
> >
> >
> >|||"Ajey" <ajey5@.hotmail.com> wrote in message
news:OfmIdX8SFHA.2560@.TK2MSFTNGP09.phx.gbl...
> Thanks.
> Yes, that's what i want to do.
> And also I want to prevent sql-injection. Thanks John.
> I want to restrict the query to SELECT. I even if the user has permissions
> to modify the table I don't want him to alter it through the query.
> How can I open ADO with read only permissons?
1. Set the Mode property of the underlying connection to adModeRead, and
2. Set the recordset.LockType property to adLockReadOnly
-Mark
> Thanks in advance.
> Ajey
> "Chandra" <Chandra@.discussions.microsoft.com> wrote in message
> news:CF97CE16-EFCF-4212-811C-A8C95E28D03E@.microsoft.com...
>> Hi,
>> By the post I understand that, u have a layee between the database and
>> the
>> user.
>> The user need to send a select query and the result is displayed in the
> Grid.
>> The users are presently having a flexibility to send the any kind of
> query.
>> If they send INSERT, UPDATE or DELETE, your data will be currupted, and
> you
>> wante to restrict that.
>> If my prediction was correct, what I suggest you is, to use a Stored
>> Procedure for this purpose or open the ADO with read only permissions.
>> I believe this answered your question. please revert back if u have any
> issues
>> thanks and regards
>> Chandra
>>
>> "Ajey" wrote:
>> > Hi,
>> > Can I restrict INSERT, DELETE, UPDATE, INTO queries in ADO? I get
> the
>> > query as input from user. Run it using ADO connection. Display the
> result in
>> > grid. However I want to allow only SELECT queries. Is there a property
> on
>> > ADO which allows this? Otherwise I will have to do the parsing myself.
>> >
>> > Thanks in advance.
>> > Ajey
>> >
>> >
>> >
>> >
>|||You can do this while you are opening the connection itself.
For More info refer to:
http://www.codeguru.com/vb/gen/vb_database/adonet/article.php/c5153/
"Ajey" wrote:
> Thanks.
> Yes, that's what i want to do.
> And also I want to prevent sql-injection. Thanks John.
> I want to restrict the query to SELECT. I even if the user has permissions
> to modify the table I don't want him to alter it through the query.
> How can I open ADO with read only permissons?
> Thanks in advance.
> Ajey
> "Chandra" <Chandra@.discussions.microsoft.com> wrote in message
> news:CF97CE16-EFCF-4212-811C-A8C95E28D03E@.microsoft.com...
> > Hi,
> > By the post I understand that, u have a layee between the database and the
> > user.
> > The user need to send a select query and the result is displayed in the
> Grid.
> >
> > The users are presently having a flexibility to send the any kind of
> query.
> > If they send INSERT, UPDATE or DELETE, your data will be currupted, and
> you
> > wante to restrict that.
> >
> > If my prediction was correct, what I suggest you is, to use a Stored
> > Procedure for this purpose or open the ADO with read only permissions.
> >
> > I believe this answered your question. please revert back if u have any
> issues
> >
> > thanks and regards
> > Chandra
> >
> >
> >
> > "Ajey" wrote:
> >
> > > Hi,
> > > Can I restrict INSERT, DELETE, UPDATE, INTO queries in ADO? I get
> the
> > > query as input from user. Run it using ADO connection. Display the
> result in
> > > grid. However I want to allow only SELECT queries. Is there a property
> on
> > > ADO which allows this? Otherwise I will have to do the parsing myself.
> > >
> > > Thanks in advance.
> > > Ajey
> > >
> > >
> > >
> > >
>
>|||It's not working:
Following is the sample code:
----
--
g_objConn.Mode = adModeRead
g_objConn.Open strConn, , , 0
Debug.Print g_objConn.Mode
strQuery = "select * from sysobjects select * from sysindexes insert
into testtable values ('xyz')"
Set objRS = New Recordset
'Set objRS = g_objConn.Execute(strQuery)
objRS.Open strQuery, g_objConn, adOpenForwardOnly, adLockReadOnly,
adCmdText
----
--
After the Open on recordset the insert is always successful.
Thanks.
Ajey
"Mark J. McGinty" <mmcginty@.spamfromyou.com> wrote in message
news:OWodsc8SFHA.3980@.TK2MSFTNGP12.phx.gbl...
> "Ajey" <ajey5@.hotmail.com> wrote in message
> news:OfmIdX8SFHA.2560@.TK2MSFTNGP09.phx.gbl...
> > Thanks.
> > Yes, that's what i want to do.
> > And also I want to prevent sql-injection. Thanks John.
> > I want to restrict the query to SELECT. I even if the user has
permissions
> > to modify the table I don't want him to alter it through the query.
> >
> > How can I open ADO with read only permissons?
> 1. Set the Mode property of the underlying connection to adModeRead, and
> 2. Set the recordset.LockType property to adLockReadOnly
>
> -Mark
>
>
> > Thanks in advance.
> > Ajey
> >
> > "Chandra" <Chandra@.discussions.microsoft.com> wrote in message
> > news:CF97CE16-EFCF-4212-811C-A8C95E28D03E@.microsoft.com...
> >> Hi,
> >> By the post I understand that, u have a layee between the database and
> >> the
> >> user.
> >> The user need to send a select query and the result is displayed in the
> > Grid.
> >>
> >> The users are presently having a flexibility to send the any kind of
> > query.
> >> If they send INSERT, UPDATE or DELETE, your data will be currupted, and
> > you
> >> wante to restrict that.
> >>
> >> If my prediction was correct, what I suggest you is, to use a Stored
> >> Procedure for this purpose or open the ADO with read only permissions.
> >>
> >> I believe this answered your question. please revert back if u have any
> > issues
> >>
> >> thanks and regards
> >> Chandra
> >>
> >>
> >>
> >> "Ajey" wrote:
> >>
> >> > Hi,
> >> > Can I restrict INSERT, DELETE, UPDATE, INTO queries in ADO? I
get
> > the
> >> > query as input from user. Run it using ADO connection. Display the
> > result in
> >> > grid. However I want to allow only SELECT queries. Is there a
property
> > on
> >> > ADO which allows this? Otherwise I will have to do the parsing
myself.
> >> >
> >> > Thanks in advance.
> >> > Ajey
> >> >
> >> >
> >> >
> >> >
> >
> >
>|||I am not using ADO.NET but it's a simple ADO application.
Thanks.
Ajey
"Chandra" <Chandra@.discussions.microsoft.com> wrote in message
news:F419CECC-2DF9-4C52-953F-CEA0334B0336@.microsoft.com...
> You can do this while you are opening the connection itself.
> For More info refer to:
> http://www.codeguru.com/vb/gen/vb_database/adonet/article.php/c5153/
>
>
> "Ajey" wrote:
> > Thanks.
> > Yes, that's what i want to do.
> > And also I want to prevent sql-injection. Thanks John.
> > I want to restrict the query to SELECT. I even if the user has
permissions
> > to modify the table I don't want him to alter it through the query.
> >
> > How can I open ADO with read only permissons?
> >
> > Thanks in advance.
> > Ajey
> >
> > "Chandra" <Chandra@.discussions.microsoft.com> wrote in message
> > news:CF97CE16-EFCF-4212-811C-A8C95E28D03E@.microsoft.com...
> > > Hi,
> > > By the post I understand that, u have a layee between the database and
the
> > > user.
> > > The user need to send a select query and the result is displayed in
the
> > Grid.
> > >
> > > The users are presently having a flexibility to send the any kind of
> > query.
> > > If they send INSERT, UPDATE or DELETE, your data will be currupted,
and
> > you
> > > wante to restrict that.
> > >
> > > If my prediction was correct, what I suggest you is, to use a Stored
> > > Procedure for this purpose or open the ADO with read only permissions.
> > >
> > > I believe this answered your question. please revert back if u have
any
> > issues
> > >
> > > thanks and regards
> > > Chandra
> > >
> > >
> > >
> > > "Ajey" wrote:
> > >
> > > > Hi,
> > > > Can I restrict INSERT, DELETE, UPDATE, INTO queries in ADO? I
get
> > the
> > > > query as input from user. Run it using ADO connection. Display the
> > result in
> > > > grid. However I want to allow only SELECT queries. Is there a
property
> > on
> > > > ADO which allows this? Otherwise I will have to do the parsing
myself.
> > > >
> > > > Thanks in advance.
> > > > Ajey
> > > >
> > > >
> > > >
> > > >
> >
> >
> >|||Hi Ajey
Will this be of any help:
===========
Set conn = New ADODB.Connection
conn.Open "dns=<>"
Dim rs As ADODB.Recordset
' Open the table.
Set rs = New ADODB.Recordset
rs.Open Query, conn, adOpenDynamic, adLockReadOnly
===========
thanks and regards
Chandar
"Ajey" wrote:
> I am not using ADO.NET but it's a simple ADO application.
> Thanks.
> Ajey
> "Chandra" <Chandra@.discussions.microsoft.com> wrote in message
> news:F419CECC-2DF9-4C52-953F-CEA0334B0336@.microsoft.com...
> > You can do this while you are opening the connection itself.
> >
> > For More info refer to:
> > http://www.codeguru.com/vb/gen/vb_database/adonet/article.php/c5153/
> >
> >
> >
> >
> > "Ajey" wrote:
> >
> > > Thanks.
> > > Yes, that's what i want to do.
> > > And also I want to prevent sql-injection. Thanks John.
> > > I want to restrict the query to SELECT. I even if the user has
> permissions
> > > to modify the table I don't want him to alter it through the query.
> > >
> > > How can I open ADO with read only permissons?
> > >
> > > Thanks in advance.
> > > Ajey
> > >
> > > "Chandra" <Chandra@.discussions.microsoft.com> wrote in message
> > > news:CF97CE16-EFCF-4212-811C-A8C95E28D03E@.microsoft.com...
> > > > Hi,
> > > > By the post I understand that, u have a layee between the database and
> the
> > > > user.
> > > > The user need to send a select query and the result is displayed in
> the
> > > Grid.
> > > >
> > > > The users are presently having a flexibility to send the any kind of
> > > query.
> > > > If they send INSERT, UPDATE or DELETE, your data will be currupted,
> and
> > > you
> > > > wante to restrict that.
> > > >
> > > > If my prediction was correct, what I suggest you is, to use a Stored
> > > > Procedure for this purpose or open the ADO with read only permissions.
> > > >
> > > > I believe this answered your question. please revert back if u have
> any
> > > issues
> > > >
> > > > thanks and regards
> > > > Chandra
> > > >
> > > >
> > > >
> > > > "Ajey" wrote:
> > > >
> > > > > Hi,
> > > > > Can I restrict INSERT, DELETE, UPDATE, INTO queries in ADO? I
> get
> > > the
> > > > > query as input from user. Run it using ADO connection. Display the
> > > result in
> > > > > grid. However I want to allow only SELECT queries. Is there a
> property
> > > on
> > > > > ADO which allows this? Otherwise I will have to do the parsing
> myself.
> > > > >
> > > > > Thanks in advance.
> > > > > Ajey
> > > > >
> > > > >
> > > > >
> > > > >
> > >
> > >
> > >
>
>|||This seems to be doing the trick. I get following error when I try to
execute multiple queries:
sp_cursoropen/sp_cursorprepare: The statement parameter can only be a single
select or a single stored procedure. : Microsoft OLE DB Provider for SQL
Server
But I don't want to use adOpenDynamic but adOpenForwardOnly cursor type.
At least this now blocks the user from executing multiple statement and so i
can check only the first token to be SELECT.
But can I achive same using adOpenForwardOnly cursor type.
Thanks.
Ajey
"Chandra" <Chandra@.discussions.microsoft.com> wrote in message
news:34579EEE-DFDA-4768-9CD8-B5AAFEBE66B3@.microsoft.com...
> Hi Ajey
> Will this be of any help:
> ===========> Set conn = New ADODB.Connection
> conn.Open "dns=<>"
>
> Dim rs As ADODB.Recordset
> ' Open the table.
> Set rs = New ADODB.Recordset
> rs.Open Query, conn, adOpenDynamic, adLockReadOnly
> ===========> thanks and regards
> Chandar
>
> "Ajey" wrote:
> > I am not using ADO.NET but it's a simple ADO application.
> >
> > Thanks.
> > Ajey
> >
> > "Chandra" <Chandra@.discussions.microsoft.com> wrote in message
> > news:F419CECC-2DF9-4C52-953F-CEA0334B0336@.microsoft.com...
> > > You can do this while you are opening the connection itself.
> > >
> > > For More info refer to:
> > > http://www.codeguru.com/vb/gen/vb_database/adonet/article.php/c5153/
> > >
> > >
> > >
> > >
> > > "Ajey" wrote:
> > >
> > > > Thanks.
> > > > Yes, that's what i want to do.
> > > > And also I want to prevent sql-injection. Thanks John.
> > > > I want to restrict the query to SELECT. I even if the user has
> > permissions
> > > > to modify the table I don't want him to alter it through the query.
> > > >
> > > > How can I open ADO with read only permissons?
> > > >
> > > > Thanks in advance.
> > > > Ajey
> > > >
> > > > "Chandra" <Chandra@.discussions.microsoft.com> wrote in message
> > > > news:CF97CE16-EFCF-4212-811C-A8C95E28D03E@.microsoft.com...
> > > > > Hi,
> > > > > By the post I understand that, u have a layee between the database
and
> > the
> > > > > user.
> > > > > The user need to send a select query and the result is displayed
in
> > the
> > > > Grid.
> > > > >
> > > > > The users are presently having a flexibility to send the any kind
of
> > > > query.
> > > > > If they send INSERT, UPDATE or DELETE, your data will be
currupted,
> > and
> > > > you
> > > > > wante to restrict that.
> > > > >
> > > > > If my prediction was correct, what I suggest you is, to use a
Stored
> > > > > Procedure for this purpose or open the ADO with read only
permissions.
> > > > >
> > > > > I believe this answered your question. please revert back if u
have
> > any
> > > > issues
> > > > >
> > > > > thanks and regards
> > > > > Chandra
> > > > >
> > > > >
> > > > >
> > > > > "Ajey" wrote:
> > > > >
> > > > > > Hi,
> > > > > > Can I restrict INSERT, DELETE, UPDATE, INTO queries in ADO?
I
> > get
> > > > the
> > > > > > query as input from user. Run it using ADO connection. Display
the
> > > > result in
> > > > > > grid. However I want to allow only SELECT queries. Is there a
> > property
> > > > on
> > > > > > ADO which allows this? Otherwise I will have to do the parsing
> > myself.
> > > > > >
> > > > > > Thanks in advance.
> > > > > > Ajey
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > >
> > > >
> > > >
> >
> >
> >|||Hi Ajey
Good to know that ur problem is getting solved. adLockReadOnly will prevent
the users from using INSERT, DELETE and UPDATE. The cursor type is optional.
You can ignore it and procede further.
thanks and regards
Chandra
"Ajey" wrote:
> This seems to be doing the trick. I get following error when I try to
> execute multiple queries:
> sp_cursoropen/sp_cursorprepare: The statement parameter can only be a single
> select or a single stored procedure. : Microsoft OLE DB Provider for SQL
> Server
> But I don't want to use adOpenDynamic but adOpenForwardOnly cursor type.
> At least this now blocks the user from executing multiple statement and so i
> can check only the first token to be SELECT.
> But can I achive same using adOpenForwardOnly cursor type.
> Thanks.
> Ajey
> "Chandra" <Chandra@.discussions.microsoft.com> wrote in message
> news:34579EEE-DFDA-4768-9CD8-B5AAFEBE66B3@.microsoft.com...
> > Hi Ajey
> >
> > Will this be of any help:
> >
> > ===========> >
> > Set conn = New ADODB.Connection
> > conn.Open "dns=<>"
> >
> >
> >
> > Dim rs As ADODB.Recordset
> >
> > ' Open the table.
> > Set rs = New ADODB.Recordset
> > rs.Open Query, conn, adOpenDynamic, adLockReadOnly
> >
> > ===========> >
> > thanks and regards
> > Chandar
> >
> >
> > "Ajey" wrote:
> >
> > > I am not using ADO.NET but it's a simple ADO application.
> > >
> > > Thanks.
> > > Ajey
> > >
> > > "Chandra" <Chandra@.discussions.microsoft.com> wrote in message
> > > news:F419CECC-2DF9-4C52-953F-CEA0334B0336@.microsoft.com...
> > > > You can do this while you are opening the connection itself.
> > > >
> > > > For More info refer to:
> > > > http://www.codeguru.com/vb/gen/vb_database/adonet/article.php/c5153/
> > > >
> > > >
> > > >
> > > >
> > > > "Ajey" wrote:
> > > >
> > > > > Thanks.
> > > > > Yes, that's what i want to do.
> > > > > And also I want to prevent sql-injection. Thanks John.
> > > > > I want to restrict the query to SELECT. I even if the user has
> > > permissions
> > > > > to modify the table I don't want him to alter it through the query.
> > > > >
> > > > > How can I open ADO with read only permissons?
> > > > >
> > > > > Thanks in advance.
> > > > > Ajey
> > > > >
> > > > > "Chandra" <Chandra@.discussions.microsoft.com> wrote in message
> > > > > news:CF97CE16-EFCF-4212-811C-A8C95E28D03E@.microsoft.com...
> > > > > > Hi,
> > > > > > By the post I understand that, u have a layee between the database
> and
> > > the
> > > > > > user.
> > > > > > The user need to send a select query and the result is displayed
> in
> > > the
> > > > > Grid.
> > > > > >
> > > > > > The users are presently having a flexibility to send the any kind
> of
> > > > > query.
> > > > > > If they send INSERT, UPDATE or DELETE, your data will be
> currupted,
> > > and
> > > > > you
> > > > > > wante to restrict that.
> > > > > >
> > > > > > If my prediction was correct, what I suggest you is, to use a
> Stored
> > > > > > Procedure for this purpose or open the ADO with read only
> permissions.
> > > > > >
> > > > > > I believe this answered your question. please revert back if u
> have
> > > any
> > > > > issues
> > > > > >
> > > > > > thanks and regards
> > > > > > Chandra
> > > > > >
> > > > > >
> > > > > >
> > > > > > "Ajey" wrote:
> > > > > >
> > > > > > > Hi,
> > > > > > > Can I restrict INSERT, DELETE, UPDATE, INTO queries in ADO?
> I
> > > get
> > > > > the
> > > > > > > query as input from user. Run it using ADO connection. Display
> the
> > > > > result in
> > > > > > > grid. However I want to allow only SELECT queries. Is there a
> > > property
> > > > > on
> > > > > > > ADO which allows this? Otherwise I will have to do the parsing
> > > myself.
> > > > > > >
> > > > > > > Thanks in advance.
> > > > > > > Ajey
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > >
> > > > >
> > > > >
> > >
> > >
> > >
>
>|||The error comes only when I specify the cusrosor type as adOpenDynamic and
not when adOpenForwardOnly
"Chandra" <Chandra@.discussions.microsoft.com> wrote in message
news:7F7945AF-AACD-4545-B5F2-1ACE9D3FD1D7@.microsoft.com...
> Hi Ajey
> Good to know that ur problem is getting solved. adLockReadOnly will
prevent
> the users from using INSERT, DELETE and UPDATE. The cursor type is
optional.
> You can ignore it and procede further.
> thanks and regards
> Chandra
>
>
> "Ajey" wrote:
> > This seems to be doing the trick. I get following error when I try to
> > execute multiple queries:
> > sp_cursoropen/sp_cursorprepare: The statement parameter can only be a
single
> > select or a single stored procedure. : Microsoft OLE DB Provider for SQL
> > Server
> >
> > But I don't want to use adOpenDynamic but adOpenForwardOnly cursor type.
> >
> > At least this now blocks the user from executing multiple statement and
so i
> > can check only the first token to be SELECT.
> > But can I achive same using adOpenForwardOnly cursor type.
> >
> > Thanks.
> > Ajey
> >
> > "Chandra" <Chandra@.discussions.microsoft.com> wrote in message
> > news:34579EEE-DFDA-4768-9CD8-B5AAFEBE66B3@.microsoft.com...
> > > Hi Ajey
> > >
> > > Will this be of any help:
> > >
> > > ===========> > >
> > > Set conn = New ADODB.Connection
> > > conn.Open "dns=<>"
> > >
> > >
> > >
> > > Dim rs As ADODB.Recordset
> > >
> > > ' Open the table.
> > > Set rs = New ADODB.Recordset
> > > rs.Open Query, conn, adOpenDynamic, adLockReadOnly
> > >
> > > ===========> > >
> > > thanks and regards
> > > Chandar
> > >
> > >
> > > "Ajey" wrote:
> > >
> > > > I am not using ADO.NET but it's a simple ADO application.
> > > >
> > > > Thanks.
> > > > Ajey
> > > >
> > > > "Chandra" <Chandra@.discussions.microsoft.com> wrote in message
> > > > news:F419CECC-2DF9-4C52-953F-CEA0334B0336@.microsoft.com...
> > > > > You can do this while you are opening the connection itself.
> > > > >
> > > > > For More info refer to:
> > > > >
http://www.codeguru.com/vb/gen/vb_database/adonet/article.php/c5153/
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > "Ajey" wrote:
> > > > >
> > > > > > Thanks.
> > > > > > Yes, that's what i want to do.
> > > > > > And also I want to prevent sql-injection. Thanks John.
> > > > > > I want to restrict the query to SELECT. I even if the user has
> > > > permissions
> > > > > > to modify the table I don't want him to alter it through the
query.
> > > > > >
> > > > > > How can I open ADO with read only permissons?
> > > > > >
> > > > > > Thanks in advance.
> > > > > > Ajey
> > > > > >
> > > > > > "Chandra" <Chandra@.discussions.microsoft.com> wrote in message
> > > > > > news:CF97CE16-EFCF-4212-811C-A8C95E28D03E@.microsoft.com...
> > > > > > > Hi,
> > > > > > > By the post I understand that, u have a layee between the
database
> > and
> > > > the
> > > > > > > user.
> > > > > > > The user need to send a select query and the result is
displayed
> > in
> > > > the
> > > > > > Grid.
> > > > > > >
> > > > > > > The users are presently having a flexibility to send the any
kind
> > of
> > > > > > query.
> > > > > > > If they send INSERT, UPDATE or DELETE, your data will be
> > currupted,
> > > > and
> > > > > > you
> > > > > > > wante to restrict that.
> > > > > > >
> > > > > > > If my prediction was correct, what I suggest you is, to use a
> > Stored
> > > > > > > Procedure for this purpose or open the ADO with read only
> > permissions.
> > > > > > >
> > > > > > > I believe this answered your question. please revert back if u
> > have
> > > > any
> > > > > > issues
> > > > > > >
> > > > > > > thanks and regards
> > > > > > > Chandra
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > "Ajey" wrote:
> > > > > > >
> > > > > > > > Hi,
> > > > > > > > Can I restrict INSERT, DELETE, UPDATE, INTO queries in
ADO?
> > I
> > > > get
> > > > > > the
> > > > > > > > query as input from user. Run it using ADO connection.
Display
> > the
> > > > > > result in
> > > > > > > > grid. However I want to allow only SELECT queries. Is there
a
> > > > property
> > > > > > on
> > > > > > > > ADO which allows this? Otherwise I will have to do the
parsing
> > > > myself.
> > > > > > > >
> > > > > > > > Thanks in advance.
> > > > > > > > Ajey
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > >
> > > >
> > > >
> >
> >
> >|||Also, I created a stored procedure sp_my_sp2 which raises an error on
execution.
When I try to run multiple queries as:
sp_my_sp2 select * from sysobjects
I can verify that the stored proc as well as the SELECT query gets executed.
But for the following:
select * from sysobjects sp_my_sp2
only the SELECT query gets executed.
What's the behavior for multiple queries in SQL Server?
Thanks in advance.
Ajey
"Ajey" <ajey5@.hotmail.com> wrote in message
news:e8bxOD8SFHA.612@.TK2MSFTNGP12.phx.gbl...
> Hi,
> Can I restrict INSERT, DELETE, UPDATE, INTO queries in ADO? I get the
> query as input from user. Run it using ADO connection. Display the result
in
> grid. However I want to allow only SELECT queries. Is there a property on
> ADO which allows this? Otherwise I will have to do the parsing myself.
> Thanks in advance.
> Ajey
>
>|||"Ajey" <ajey5@.hotmail.com> wrote in message
news:%23Dd%23xs$SFHA.2520@.TK2MSFTNGP09.phx.gbl...
> Also, I created a stored procedure sp_my_sp2 which raises an error on
> execution.
> When I try to run multiple queries as:
> sp_my_sp2 select * from sysobjects
> I can verify that the stored proc as well as the SELECT query gets
> executed.
> But for the following:
> select * from sysobjects sp_my_sp2
select * from sysobjects; exec sp_my_sp2
-Mark
> only the SELECT query gets executed.
> What's the behavior for multiple queries in SQL Server?
> Thanks in advance.
> Ajey
>
> "Ajey" <ajey5@.hotmail.com> wrote in message
> news:e8bxOD8SFHA.612@.TK2MSFTNGP12.phx.gbl...
>> Hi,
>> Can I restrict INSERT, DELETE, UPDATE, INTO queries in ADO? I get
>> the
>> query as input from user. Run it using ADO connection. Display the result
> in
>> grid. However I want to allow only SELECT queries. Is there a property on
>> ADO which allows this? Otherwise I will have to do the parsing myself.
>> Thanks in advance.
>> Ajey
>>
>|||That helps to execute the stored procedure as well
I wanted to make sure that user does not enter any other statement other
than SELECT. I can put restriction on having keywords INSERT, UPDATE,
DELETE, INTO, EXEC, EXECUTE in the query string but what about stored
procedure given as mentioned below. With the execution i verified that in
this case the stored procedure does not get executed. But is this behavior
documented?
"Mark J. McGinty" <mmcginty@.spamfromyou.com> wrote in message
news:2j6ce.1$ZN.0@.fed1read07...
> "Ajey" <ajey5@.hotmail.com> wrote in message
> news:%23Dd%23xs$SFHA.2520@.TK2MSFTNGP09.phx.gbl...
> > Also, I created a stored procedure sp_my_sp2 which raises an error on
> > execution.
> > When I try to run multiple queries as:
> > sp_my_sp2 select * from sysobjects
> > I can verify that the stored proc as well as the SELECT query gets
> > executed.
> >
> > But for the following:
> > select * from sysobjects sp_my_sp2
>
> select * from sysobjects; exec sp_my_sp2
>
> -Mark
>
>
> > only the SELECT query gets executed.
> >
> > What's the behavior for multiple queries in SQL Server?
> >
> > Thanks in advance.
> > Ajey
> >
> >
> > "Ajey" <ajey5@.hotmail.com> wrote in message
> > news:e8bxOD8SFHA.612@.TK2MSFTNGP12.phx.gbl...
> >> Hi,
> >> Can I restrict INSERT, DELETE, UPDATE, INTO queries in ADO? I get
> >> the
> >> query as input from user. Run it using ADO connection. Display the
result
> > in
> >> grid. However I want to allow only SELECT queries. Is there a property
on
> >> ADO which allows this? Otherwise I will have to do the parsing myself.
> >>
> >> Thanks in advance.
> >> Ajey
> >>
> >>
> >>
> >
> >
>|||"Ajey" <ajey5@.hotmail.com> wrote in message
news:uAiO1EATFHA.2996@.TK2MSFTNGP15.phx.gbl...
> That helps to execute the stored procedure as well
> I wanted to make sure that user does not enter any other statement other
> than SELECT. I can put restriction on having keywords INSERT, UPDATE,
> DELETE, INTO, EXEC, EXECUTE in the query string but what about stored
> procedure given as mentioned below. With the execution i verified that in
> this case the stored procedure does not get executed. But is this behavior
> documented?
Not sure if it's documented, but it has been that way forever (given that
SQL 6.5 marked the beginning of time.)
Just the stored procedure name (with args if any) alone will work for a
single statement, but you must use exec for each statement in a batch.
-Mark
> "Mark J. McGinty" <mmcginty@.spamfromyou.com> wrote in message
> news:2j6ce.1$ZN.0@.fed1read07...
>> "Ajey" <ajey5@.hotmail.com> wrote in message
>> news:%23Dd%23xs$SFHA.2520@.TK2MSFTNGP09.phx.gbl...
>> > Also, I created a stored procedure sp_my_sp2 which raises an error on
>> > execution.
>> > When I try to run multiple queries as:
>> > sp_my_sp2 select * from sysobjects
>> > I can verify that the stored proc as well as the SELECT query gets
>> > executed.
>> >
>> > But for the following:
>> > select * from sysobjects sp_my_sp2
>>
>> select * from sysobjects; exec sp_my_sp2
>>
>> -Mark
>>
>>
>> > only the SELECT query gets executed.
>> >
>> > What's the behavior for multiple queries in SQL Server?
>> >
>> > Thanks in advance.
>> > Ajey
>> >
>> >
>> > "Ajey" <ajey5@.hotmail.com> wrote in message
>> > news:e8bxOD8SFHA.612@.TK2MSFTNGP12.phx.gbl...
>> >> Hi,
>> >> Can I restrict INSERT, DELETE, UPDATE, INTO queries in ADO? I get
>> >> the
>> >> query as input from user. Run it using ADO connection. Display the
> result
>> > in
>> >> grid. However I want to allow only SELECT queries. Is there a property
> on
>> >> ADO which allows this? Otherwise I will have to do the parsing myself.
>> >>
>> >> Thanks in advance.
>> >> Ajey
>> >>
>> >>
>> >>
>> >
>> >
>>
>|||Thank Mark.
I even verified with the query execution plan to make sure that the stored
proc does not get executed. But then why no error is shown for the stored
proc name.
"Mark J. McGinty" <mmcginty@.spamfromyou.com> wrote in message
news:2g8ce.17$ZN.14@.fed1read07...
> "Ajey" <ajey5@.hotmail.com> wrote in message
> news:uAiO1EATFHA.2996@.TK2MSFTNGP15.phx.gbl...
> > That helps to execute the stored procedure as well
> > I wanted to make sure that user does not enter any other statement other
> > than SELECT. I can put restriction on having keywords INSERT, UPDATE,
> > DELETE, INTO, EXEC, EXECUTE in the query string but what about stored
> > procedure given as mentioned below. With the execution i verified that
in
> > this case the stored procedure does not get executed. But is this
behavior
> > documented?
> Not sure if it's documented, but it has been that way forever (given that
> SQL 6.5 marked the beginning of time.)
> Just the stored procedure name (with args if any) alone will work for a
> single statement, but you must use exec for each statement in a batch.
> -Mark
>
>
> > "Mark J. McGinty" <mmcginty@.spamfromyou.com> wrote in message
> > news:2j6ce.1$ZN.0@.fed1read07...
> >>
> >> "Ajey" <ajey5@.hotmail.com> wrote in message
> >> news:%23Dd%23xs$SFHA.2520@.TK2MSFTNGP09.phx.gbl...
> >> > Also, I created a stored procedure sp_my_sp2 which raises an error on
> >> > execution.
> >> > When I try to run multiple queries as:
> >> > sp_my_sp2 select * from sysobjects
> >> > I can verify that the stored proc as well as the SELECT query gets
> >> > executed.
> >> >
> >> > But for the following:
> >> > select * from sysobjects sp_my_sp2
> >>
> >>
> >> select * from sysobjects; exec sp_my_sp2
> >>
> >>
> >> -Mark
> >>
> >>
> >>
> >>
> >>
> >> > only the SELECT query gets executed.
> >> >
> >> > What's the behavior for multiple queries in SQL Server?
> >> >
> >> > Thanks in advance.
> >> > Ajey
> >> >
> >> >
> >> > "Ajey" <ajey5@.hotmail.com> wrote in message
> >> > news:e8bxOD8SFHA.612@.TK2MSFTNGP12.phx.gbl...
> >> >> Hi,
> >> >> Can I restrict INSERT, DELETE, UPDATE, INTO queries in ADO? I
get
> >> >> the
> >> >> query as input from user. Run it using ADO connection. Display the
> > result
> >> > in
> >> >> grid. However I want to allow only SELECT queries. Is there a
property
> > on
> >> >> ADO which allows this? Otherwise I will have to do the parsing
myself.
> >> >>
> >> >> Thanks in advance.
> >> >> Ajey
> >> >>
> >> >>
> >> >>
> >> >
> >> >
> >>
> >>
> >
> >
>