Showing posts with label object. Show all posts
Showing posts with label object. Show all posts

Thursday, March 22, 2012

AdventureWorks, invalid object name error

Hi, I will start step by step:

1. a new web site with VS 2005.

2. I added a sqldatasouce and connect with AdventureWorks sample database ,which comes with sql server 2005 developer edition, selected by drop-down list. [ server name:(local) ]

3. Test connection. It is OK.

4. Saved as 'AdventureWorksConnectionString'.

5. Some columns are selected in the 'product' table.

6. At the end while testing query with 'test query' button it gives:

"There was an error executing the query. Please check the syntax of the command and if present, the types and values of parameters and ensure the are correct.

Invalid object name 'Product'. "

7. However when I choice NorthWind database sample I installed externally, there is no problem.Moreover, when I choice AWBuildVersion table in the AdventureWorks, and it's columns, there is also no problem.

8. I compared NorthWind and AdventureWorks security properties in the SQL server managment studio, but can't find any differences.

9. I have been searching all the web since two days.

10. Thanks.

can you paste the SQL command that fails...

|||

There are two problems.

The AdventureWorks database uses a "Schema.Table" naming convention that the SQLDataSource Wizard doesn't pickup.

Table Names are Case-Sensitive in the AdventureWorks database.

Workaround:

Instead of "Specify columns from table or view", select "Specify a custom SQL statement..."

On the next screen, use the "Query Builder" to generate the SQL statement. It will pickup the schema name.

PS: After I post this message, I'm going to move this thread to the SQL database forum. I think it's more appropriate there.

|||

Yeah, it works... Thank you very much... But,I couldn't figure out why this happened to me, because I have started to read"Addison Wesley ASP NET .2.0 Illustrated". In that book, it is theprocedure how to implement AdventureWorks database in Chapter 2, and does normention any info of "Schema.Table" and SQLDataSouce relation. Ihave tried some method to accomplish that with "Specify columns from tableor view" method:

Source Code of"Specify columns from table or view" method which gives error:

<asp:SqlDataSource ID="SqlDataSource3" runat="server"ConnectionString="<%$ ConnectionStrings:AdventureWorksConnectionString%>"
ProviderName="<%$ConnectionStrings:AdventureWorksConnectionString.ProviderName %>"
SelectCommand="SELECT [ProductID], [Name], [ProductNumber], [ListPrice],[Color], [SafetyStockLevel], [StandardCost], [Size] FROM[Product]">
</asp:SqlDataSource>


Source Code of "Specify a custom SQL statement..."and applying "Query Builder" method which gives NO error:

<asp:SqlDataSource ID="SqlDataSource3" runat="server"ConnectionString="<%$ ConnectionStrings:AdventureWorksConnectionString%>"
SelectCommand="SELECT ProductID, Name, ProductNumber, ListPrice, Color,SafetyStockLevel, StandardCost, Size FROMProduction.Product">
</asp:SqlDataSource>

What I could try as a beginner to get a validoutput is changing[Product] as Production.Product.Of course, it gives the same 'invalid object name' error.

As I told you before, AWBuildVersion tablegives no error with "Specify columns from table or view" method:

<asp:SqlDataSource ID="SqlDataSource3" runat="server"ConnectionString="<%$ ConnectionStrings:AdventureWorksConnectionString%>"
ProviderName="<%$ ConnectionStrings:AdventureWorksConnectionString.ProviderName%>"
SelectCommand="SELECT [SystemInformationID], [Database Version] ASDatabase_Version, [VersionDate], [ModifiedDate] FROM [AWBuildVersion]">
</asp:SqlDataSource>

I have understood from your note theonly way to implement "Schema.Table" s is use the "QueryBuilder", right?

And for your consideration here is Stack Trace:
------
SqlException (0x80131904): Invalid object name 'Product'.]

System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +177

System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +68

System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +199

System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +2406

System.Data.SqlClient.SqlDataReader.ConsumeMetaData() +31

System.Data.SqlClient.SqlDataReader.get_MetaData() +62

System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +294

System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +1038

System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +314

System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) +20

System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) +107

System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior) +10

System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior) +7

System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +139

System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +140

System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable) +83

System.Web.UI.WebControls.SqlDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +1657

System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +13

System.Web.UI.WebControls.DataBoundControl.PerformSelect() +140

System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +68

System.Web.UI.WebControls.GridView.DataBind() +5

System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +61

System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls() +67

System.Web.UI.Control.EnsureChildControls() +97

System.Web.UI.Control.PreRenderRecursiveInternal() +50

System.Web.UI.Control.PreRenderRecursiveInternal() +171

System.Web.UI.Control.PreRenderRecursiveInternal() +171

System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5731

------
 Again, Thank you very much to help and save my time.

sql

Tuesday, March 20, 2012

Advantages of Reporting Services 2005


Hello,

I am working on the Reporting Services 2005, I don' know anything about Business Object.

Please let me know what are the advantages of Reporting Services 2005 over the Business Object.

Any specific link will be useful for me.

Thanks in advance.

Bye.

If you already have a SQL Server 2005 box...SSRS is free. That is usually a very compelling argument. Check with MS on your specific licensing scenario though.

The next is Report Builder which is a user friendly ad-hoc tool for analysts to build their own reports without the learning curve of Visual Studio (although the learning curve is really not that high on RS).

|||

Hello Davind,

I agree with you on the advantage you have mentioned above but I have question?

Reporing services have direct connection to the database there is know any middle tire, and I throught that because of this the processing of report might be slow. In the same case Business Object have some middletire I don't know exactly.

Any help in this will be appreciated.

|||

check this blog for all the Resources link on Reporting services.

http://blogs.sqlxml.org/vinodkumar/archive/2007/09/14/sql-rs-resources-links.aspx

Madhu

|||

Yes, when you look at BO, Cognos, SAS BI etc.. it is understood that you will build some middle tier...like an OLAP cube to report.

The difference with SSRS is that it is purely a reporting tool, abstract from a datasource. So think of it this way, you CAN report directly against a live OLTP database. To your point, you may have some performance considerations to make. But you CAN also build reports against a datawarehouse (SQL) or against Cubes that have been defined.

It goes beyond that...You can also build reports directly against other datasources like Oracle, Access..I've developed real-time SSRS reports against Lawson (Oracle hosted on Unix) for example.

Lastly, you can build reports based upon Models or even SSIS. SSIS can be thought of as a middle-ware...very robust ETL tool on steroids. So think of being able to mix DW data with say..live RSS feeds or data from a web service, or some real time ETL integration?

A report model is entirely different in that you can build a report from a user friendly definition without having to have a knowledge of the table structures, field names, business rules and joins (of course that 'model' must be defined first by someone who does)..that then leaves report building in the hands of analysts..not programmers.

So the biggest thing that I see is choice..you have deep choices to make in the datasets you consume and are not limited solely to OLAP datasources or MDX code. Plus the technology is primarily standard across the Microsoft framework. Meaning, the models can be used in SSRS or even Report Builder. The OLAP cubes or datasources can of course be consumed in SSRS, but also Excel PivotTable, ProClarity...basically any cube viewer tool of choice. Those should be additional measuring sticks when looking at other vendor solutions in BI.

Tuesday, March 6, 2012

ADOMD.net Can't get the KPI.ID or Cube.ID

When you open an AS project, you will see every object has an ID property, just like KPI.ID and cube.ID and Dimention.ID. And that's diffrent of the Name property. You could chanage the name property to everything you like, but when you created an object, you could not change it's ID.

When i use the ADOMD.NET, I could do this:

Dim myKPIConnection As AdomdConnection
Dim myCubeDef As CubeDef
Dim k As Kpi

myConnectionString = "Data Source=" + myOlapServer + ";Catalog=" + myOlapDatabase + ";Provider=MSOLAP;"

myKPIConnection = New AdomdConnection(myConnectionString)
myKPIConnection.Open()

For i = 0 To myKPIConnection.Cubes.Count - 1

If myKPIConnection.Cubes(i).Type = CubeType.Cube Then

myCubeDef = myKPIConnection.Cubes(i)

k = myKPIConnection.Cubes(i).Kpis(0)

MessageBox.Show(k.Name)

MessageBox.Show(k.Caption)

end if
next

But the question is, there's no k.ID or cubes(i).ID property there!

The k.Name and k.Caption both refer to the kpi's Name property in the AS server in factly.

Is that means we could not use the object 's ID property in the ADOMD.NET?

Another question, in MDX, we could only refer a dimention by it's name, and could not by it's ID, right?

ivanchain wrote:

Is that means we could not use the object 's ID property in the ADOMD.NET?

Another question, in MDX, we could only refer a dimention by it's name, and could not by it's ID, right?

That's right. In ADOMD.NET and MDX all references are done by name. The ID property is mainly used by the administrative APIs

adomd.net cache server object

Hi All,

I have a bit of a dilemma regarding how to cache the server object so I don't have to reconnect all the time.

I have a web service which serves AS2005 data, and whenever the cube schema changes (or sometimes just after a process), the server object doesn't return the cubes collection, and I end up having to restart IIS or the app to clear the application obj and start again. Obviously this is not the best. Is there anyway I can detect for schema changes in the server object, and serve up a fresh obj if there has been?

I'm using the following code:

Code Snippet

Dim server As OlapServer.Server = Me.Application.Get(cubeServerStorageKey)
If (server Is Nothing) Then

Dim cubeServer As String = System.Configuration.ConfigurationManager.AppSettings.Get("Analysis Server")
If (String.IsNullOrEmpty(cubeServer)) Then _
cubeServer = "."

Dim cubeServerTimeoutSeconds As String = System.Configuration.ConfigurationManager.AppSettings.Get("Cube Timeout")

server = New OlapServer.Server(cubeServer, Me.RequestData.Database, Int32.Parse(cubeServerTimeoutSeconds))
server.Connect()

Me.Application.Set(cubeServerStorageKey, server)
End If

Return server

hello,

could you please clarify a bit. I believe adomd.net does not have an OlapServer class in it (nor does AMO). So, can you please provide relevant code (i guess of how the OlapServer object returns you the cubes collection, since from the problem description you mention that this is where the problem occurs), because without that code it is hard to tell what the problem might be or how to solve it.

thanks a lot,

|||

Well why would you want to cache such a connection? 100ms routine is hardly worthy of cache. Chaching the return dataset I can see, but connection? Sorry if I misunderstood.

Also, you can use .NET's cache methods to specify an exact timeout for a cached object.

Saturday, February 25, 2012

ADODB.Command error 800a0cb3

I have posted various questions on the microsoft ng trying to identify the cause of this error.

ADODB.Command error '800a0cb3'
Object or provider is not capable of performing requested operation.

I have MDAC 2.8 installed locally on my machine.

Via IIS I created a virtual directory via IIS that points to my ASP files on c:

Via the SQL Server IIS for XML configuration utility I created a virtual directory with a different names that points to the same directory as that created via IIS.

The SQL database is on a different machine and I connect via the OLEDB DSNless connection string.

I used a ADODB.Stream to transform the XML against the XSL but I couldnt get it to work. To simplify things and work towards a solution I inserted the code into my ASP from the MS KB article Q272266 (see below). I amended the ms code to change the connection code and call a stored procedure that exists on the database. The ms code gives the same error as my original code.

I tried changing the CursorLocation to server and client but the results were the same.

I put a SQL trace on the DB to determine if the stored procedure gets ran, it does not.

If I run the following in the URL it works:

If I run http://localhost/p2/?sql=SELECT+*+FROM+tblStatus+FOR+XML+AUTO&root=root&xsl=tblStatusDesc.xsl it works.
If I run the xml template it works: http://localhost/p2/xml/test.xml

The two lines above run. My IIS server uses a virtual directory called dev, so when I run the ASP I type http://localhost/DEV/secure/aframes.asp the IIS virtual directory creted by sql server is called p2 but has the same source code directory.

Here is the MS code amended as described above that does not work.

sQuery = "<ROOT xmlns:sql='urn:schemas-microsoft-com:xml-sql'><sql:query>Select StatusDesc from tblStatus for XML Auto</sql:query></ROOT>"
'*************************************************

Dim txtResults ' String for results
dim CmdStream ' as ADODB.Stream


sConn = "Provider=SQLOLEDB;Data Source=[name of sql server];UId=sa; Pwd=xxxxx; Initial Catalog=[DB Name]"

Set adoConn = CreateObject("ADODB.Connection")
Set adoStreamQuery = CreateObject("ADODB.Stream")

adoConn.ConnectionString = sConn
adoConn.Open

Set adoCmd = CreateObject("ADODB.Command")
set adoCmd.ActiveConnection = adoConn

adoConn.CursorLocation = adUseClient

Set adoCmd.ActiveConnection = adoConn

adoStreamQuery.Open ' Open the command stream so it may be written to
adoStreamQuery.WriteText sQuery, adWriteChar ' Set the input command stream's text with the query string
adoStreamQuery.Position = 0 ' Reset the position in the stream, otherwise it will be at EOS

Set adoCmd.CommandStream = adoStreamQuery ' Set the command object's command to the input stream set above
adoCmd.Dialect = "{5D531CB2-E6Ed-11D2-B252-00C04F681B71}" ' Set the dialect for the command stream to be a SQL query.
Set outStrm = CreateObject("ADODB.Stream") ' Create the output stream
outStrm.Open
adoCmd.Properties("Output Stream") = response ' Set command's output stream to the output stream just opened
adoCmd.Execute , , adExecuteStream ' Execute the command, thus filling up the output stream.

Response.Endtry this type of connection string

driver={SQL Server};server=ServerName;uid=sa;pwd=xxxx;Database =DBName|||Thanks for your response.

I think this is progress but it seems to have broken the command object and it doesn't do the execute, it fails on the line:

adoCmd.Properties("Output Stream") = response

and gives an error of:

Item cannot be found in the collection corresponding to the requested name or ordinal.|||the maybe try this provider woth your first connectionstring

Provider=SQLOLEDB.1;|||No, sorry, this gives the error;

Object or provider is not capable of performing requested operation.

On the line with the execute statement.

What I am thinking of doing is to install sql server locally and have the db on my c: and try again, perhaps it is something to do with win 2k permissions and accessing the sql server across the network. Or perhaps its cause we use host headers on the web server?

Code now:

sQuery = "<ROOT xmlns:sql='urn:schemas-microsoft-com:xml-sql'><sql:query>Select StatusDesc from tblcStatusDesc for XML Auto</sql:query></ROOT>"

'sql = "<dataroot xmlns:sql='urn:schemas-microsoft-com:xml-sql'>"
'sql = sql & "<sql:header><sql:param name='number'>" & memberNo & "</sql:param></sql:header>" & sqlQuery & "</dataroot>"

'dim sQuery
'sQuery = sql
dim sXSLfile
sXSLfile = strXSL

'sConn = "Provider=SQLOLEDB;Data Source=LON09WEB;UId=sa; Pwd=develop; Initial Catalog=NMRA_INETSOURCE"

Set adoConn = CreateObject("ADODB.Connection")
Set adoStreamQuery = CreateObject("ADODB.Stream")
set objError = CreateObject("ADODB.Error")
Set adoCmd = CreateObject("ADODB.Command")

sConn = "Provider=SQLOLEDB.1;Data Source=LON09WEB;UId=sa; Pwd=develop; Initial Catalog=NMRA_INETSOURCE"
'sConn="Provider=SQLOLEDB.1;driver={SQL Server};server=LON09WEB;uid=sa;pwd=develop;Databas e=NMRA_INETSOURCE"

Set adoConn = CreateObject("ADODB.Connection")
Set adoStreamQuery = CreateObject("ADODB.Stream")

adoConn.ConnectionString = sConn
adoConn.Open

Set adoCmd = CreateObject("ADODB.Command")
set adoCmd.ActiveConnection = adoConn

adoConn.CursorLocation = adUseClient

Set adoCmd.ActiveConnection = adoConn

adoStreamQuery.Open ' Open the command stream so it may be written to
adoStreamQuery.WriteText sQuery, adWriteChar ' Set the input command stream's text with the query string
adoStreamQuery.Position = 0 ' Reset the position in the stream, otherwise it will be at EOS

Set adoCmd.CommandStream = adoStreamQuery ' Set the command object's command to the input stream set above
adoCmd.Dialect = "{5D531CB2-E6Ed-11D2-B252-00C04F681B71}" ' Set the dialect for the command stream to be a SQL query.
Set outStrm = CreateObject("ADODB.Stream") ' Create the output stream
outStrm.Open
adoCmd.Properties("Output Stream") = response ' Set command's output stream to the output stream just opened
adoCmd.Execute , , adExecuteStream ' Execute the command, thus filling up the output stream.

Set adoConn = NOTHING
Set adoStreamQuery = NOTHING
set objError = NOTHING
Set outStrm = NOTHING|||Why are you using the Stream property ?|||I'm not really too sure. I've been copying code samples from different places and ended up with the stream property in the code. My aim is to transform the xml against xsl. I've managed to get the xml bit working all I need now is to add the xsl file name.

Dim oCmd, sSQL

Set adoConn = CreateObject("ADODB.Connection")

sConn = "Provider=[Server];Data Source=xxx;UId=xxx; Pwd=xxx; Initial Catalog=xxx"

Set oCmd = Server.CreateObject("ADODB.Command")
oCmd.ActiveConnection = sConn

oCmd.CommandText = sQuery
oCmd.Dialect = "{5D531CB2-E6Ed-11D2-B252-00C04F681B71}"
oCmd.Properties("base") =
oCmd.Properties("xsl") = "tblcStatusDesc.xsl"
oCmd.Properties("Output Stream") = Response
oCmd.Execute , , 1024|||I could give you VB code to use your db

> open/close connections
> open/commit/rollback transactions
> select data
> execute command queries

I going home soon

I'll be back only on monday (loooong WE comming up !)
if this interestes you, mail me monday|||Thanks for your help, have a great weekend.

ADODB Streams

Does anyone have an example of how to use an ADODB Stream object in a Stored
Procedure to retrieve an image column.What are you going to do with the stream inside the stored procedure?
Did you mean that you would call a stored procedure from ASP or VB and use
the ADODB.Stream object against an IMAGE column that is returned as part of
the resultset of the stored procedure? Could you provide more details?
"Brian" <bfordSPAMOFF@.markem.com> wrote in message
news:eweWRhemFHA.2580@.TK2MSFTNGP09.phx.gbl...
> Does anyone have an example of how to use an ADODB Stream object in a
> Stored
> Procedure to retrieve an image column.
>|||We are trying to extract PDF data held in an image column inserted by a 3rd
party vendor. The vendor has advised that we "Have the stored procedure use
an ADODB Stream object to get the data."
Apparantly there are some extreaneous null characters in the data due to the
method they use to insert it and they advice that the ADODB Stream object
will remove them.
I have not tried this before and so wondering if it was even possible?
Brian
"Aaron Bertrand [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in message
news:#KEDYmemFHA.3916@.TK2MSFTNGP10.phx.gbl...
> What are you going to do with the stream inside the stored procedure?
> Did you mean that you would call a stored procedure from ASP or VB and use
> the ADODB.Stream object against an IMAGE column that is returned as part
of
> the resultset of the stored procedure? Could you provide more details?
>
>
> "Brian" <bfordSPAMOFF@.markem.com> wrote in message
> news:eweWRhemFHA.2580@.TK2MSFTNGP09.phx.gbl...
>|||Brian wrote:

> Does anyone have an example of how to use an ADODB Stream object in a
> Stored Procedure to retrieve an image column.
See:
How To Access and Modify SQL Server BLOB Data by Using the ADO Stream Object
http://support.microsoft.com/?id=258038
Ben|||In that case, you would be using ADO.NET to retreive the image from the
stored procedure.
"Brian" <bfordSPAMOFF@.markem.com> wrote in message
news:%23xuPNremFHA.3648@.TK2MSFTNGP10.phx.gbl...
> We are trying to extract PDF data held in an image column inserted by a
> 3rd
> party vendor. The vendor has advised that we "Have the stored procedure
> use
> an ADODB Stream object to get the data."
> Apparantly there are some extreaneous null characters in the data due to
> the
> method they use to insert it and they advice that the ADODB Stream object
> will remove them.
> I have not tried this before and so wondering if it was even possible?
> Brian
>
> "Aaron Bertrand [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in
> message
> news:#KEDYmemFHA.3916@.TK2MSFTNGP10.phx.gbl...
> of
>|||thanks everyone.
"Ben Amada" <ben@.REpoMOweVErpick.com> wrote in message
news:uwHUO3emFHA.2472@.TK2MSFTNGP15.phx.gbl...
> Brian wrote:
>
> See:
> How To Access and Modify SQL Server BLOB Data by Using the ADO Stream
> Object
> http://support.microsoft.com/?id=258038
> Ben
>

Friday, February 24, 2012

ADO Timeout & SP

Hi,
Can someone please tell me the expected behavior of a stored procedure
when called via an ADO command object.
My question is, if ADO hits a timeout, will the SP (updates a table)
rollback what it was doing?
Thanks in advance,
Dan.It will either rollback or commit, it won't leave the transaction
hanging, if that's what you're asking. Usually when ADO times out it's
when it's trying to connect, at which time none of your stored
procedures will be in call. If you want to examine what's going on on
the server, open a Profiler trace and step through your code a line at
a time.
-- Mary
MCW Technologies
http://www.mcwtech.com
On 21 Jan 2004 03:43:53 -0800, danielcoates@.yahoo.com (Dan Coates)
wrote:
quote:

>Hi,
>Can someone please tell me the expected behavior of a stored procedure
>when called via an ADO command object.
>My question is, if ADO hits a timeout, will the SP (updates a table)
>rollback what it was doing?
>Thanks in advance,
>Dan.

ADO Timeout & SP

Hi,
Can someone please tell me the expected behavior of a stored procedure
when called via an ADO command object.
My question is, if ADO hits a timeout, will the SP (updates a table)
rollback what it was doing?
Thanks in advance,
Dan.It will either rollback or commit, it won't leave the transaction
hanging, if that's what you're asking. Usually when ADO times out it's
when it's trying to connect, at which time none of your stored
procedures will be in call. If you want to examine what's going on on
the server, open a Profiler trace and step through your code a line at
a time.
-- Mary
MCW Technologies
http://www.mcwtech.com
On 21 Jan 2004 03:43:53 -0800, danielcoates@.yahoo.com (Dan Coates)
wrote:
>Hi,
>Can someone please tell me the expected behavior of a stored procedure
>when called via an ADO command object.
>My question is, if ADO hits a timeout, will the SP (updates a table)
>rollback what it was doing?
>Thanks in advance,
>Dan.

Sunday, February 19, 2012

ADO Recorset / Set object = Nothing Issue?

I am having an issue of update statements not being
commited (lost). I am using ado 2.7 with vb6.
Here's an example that I am concerned about:
adoRS.Open "SELECT TOP 1 Field1 FROM MyTable"
adoRS.AddNew
adoRS.field("field1").value = "abc"
adoRS.update
set adoRS = Nothing
Since I am seting the ADORS object to nothing, is it
possible it's not finished executing and rolls the
transaction back?
Jason Roozeethis is technically the wrong group for this post, but here goes...
You need to make sure your cursor type supports the updates.
If I were you, I would not use rs.Update to post changes back to server.
You should consider using Command objects.
if you want more specifics, post back.
Greg Jackson
PDX, Oregon|||Your life will be a lot easier and your code will run faster if you
use SQL to update/insert/delete data. You can execute it in ADO from
either a Connection or a Command object. You also eliminate that extra
and unnecessary round trip to the database to create the recordset.
cmd.Execute "INSERT INTO MyTable (Field1) " & _
"VALUES ('" & stringvariable & "')"
-- Mary
MCW Technologies
http://www.mcwtech.com
On Fri, 6 Feb 2004 14:31:42 -0800, "Jason Roozee" <jason@.camcoinc.net>
wrote:
>I am having an issue of update statements not being
>commited (lost). I am using ado 2.7 with vb6.
>Here's an example that I am concerned about:
>adoRS.Open "SELECT TOP 1 Field1 FROM MyTable"
>adoRS.AddNew
>adoRS.field("field1").value = "abc"
>adoRS.update
>set adoRS = Nothing
>Since I am seting the ADORS object to nothing, is it
>possible it's not finished executing and rolls the
>transaction back?
>Jason Roozee|||Don't use a recordset to affect data. Recordsets are for *retrieving* data.
http://www.aspfaq.com/2191
--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/
"Jason Roozee" <jason@.camcoinc.net> wrote in message
news:b4bb01c3ed00$fe683150$a101280a@.phx.gbl...
> I am having an issue of update statements not being
> commited (lost). I am using ado 2.7 with vb6.
> Here's an example that I am concerned about:
> adoRS.Open "SELECT TOP 1 Field1 FROM MyTable"
> adoRS.AddNew
> adoRS.field("field1").value = "abc"
> adoRS.update
> set adoRS = Nothing
> Since I am seting the ADORS object to nothing, is it
> possible it's not finished executing and rolls the
> transaction back?
> Jason Roozee

ADO Recorset / Set object = Nothing Issue?

I am having an issue of update statements not being
commited (lost). I am using ado 2.7 with vb6.
Here's an example that I am concerned about:
adoRS.Open "SELECT TOP 1 Field1 FROM MyTable"
adoRS.AddNew
adoRS.field("field1").value = "abc"
adoRS.update
set adoRS = Nothing
Since I am seting the ADORS object to nothing, is it
possible it's not finished executing and rolls the
transaction back?
Jason Roozeethis is technically the wrong group for this post, but here goes...
You need to make sure your cursor type supports the updates.
If I were you, I would not use rs.Update to post changes back to server.
You should consider using Command objects.
if you want more specifics, post back.
Greg Jackson
PDX, Oregon|||Your life will be a lot easier and your code will run faster if you
use SQL to update/insert/delete data. You can execute it in ADO from
either a Connection or a Command object. You also eliminate that extra
and unnecessary round trip to the database to create the recordset.
cmd.Execute "INSERT INTO MyTable (Field1) " & _
"VALUES ('" & stringvariable & "')"
-- Mary
MCW Technologies
http://www.mcwtech.com
On Fri, 6 Feb 2004 14:31:42 -0800, "Jason Roozee" <jason@.camcoinc.net>
wrote:

>I am having an issue of update statements not being
>commited (lost). I am using ado 2.7 with vb6.
>Here's an example that I am concerned about :
>adoRS.Open "SELECT TOP 1 Field1 FROM MyTable"
>adoRS.AddNew
>adoRS.field("field1").value = "abc"
>adoRS.update
>set adoRS = Nothing
>Since I am seting the ADORS object to nothing, is it
>possible it's not finished executing and rolls the
>transaction back?
>Jason Roozee|||Don't use a recordset to affect data. Recordsets are for *retrieving* data.
http://www.aspfaq.com/2191
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/
"Jason Roozee" <jason@.camcoinc.net> wrote in message
news:b4bb01c3ed00$fe683150$a101280a@.phx.gbl...
> I am having an issue of update statements not being
> commited (lost). I am using ado 2.7 with vb6.
> Here's an example that I am concerned about :
> adoRS.Open "SELECT TOP 1 Field1 FROM MyTable"
> adoRS.AddNew
> adoRS.field("field1").value = "abc"
> adoRS.update
> set adoRS = Nothing
> Since I am seting the ADORS object to nothing, is it
> possible it's not finished executing and rolls the
> transaction back?
> Jason Roozee

ADO Recordsets object method Open

Hello group!

I use MS Visual C++ 6.0, ADO, MS SQL Server 2000.
When I attempt to open my database I meet with a following problem:
when I try to get a bookmark of the current record in a Recordset
object a following run-time error occurs: Unhandled exception in
testdb.exe(KERNEL32.DLL):
0xE06D7363: Microsoft C++ Exception.

I created my database by 3 SQL commands:

create database testdb
create table testtable
(
i int
)
insert into testtable values(0)

The error occurs in the following code snippet:
#import "D:\Program Files\Common Files\System\ADO\msado15.dll" \
no_namespace rename("EOF", "EndOfFile")
int main()
{
CoInitialize(NULL);

bstr_t strCnn("Provider=sqloledb;Data Source=;"
"Initial Catalog=testdb;Trusted_Connection=YES;");

const char* tablename = "testtable";

_RecordsetPtr recs;
recs.CreateInstance(__uuidof(Recordset) );
recs -> Open(tablename, strCnn, adOpenStatic,
adLockOptimistic,adCmdTable);
_variant_t bm = recs -> Bookmark; // the error occurs here
recs -> Close();
CoUninitialize();
}

During the debugging this code I met that the error depended on a type
of locking. When I set adLockBatchOptimistic or adLockOptimistic
or adLockPessimistic the error occurs but when I set adLockReadOnly or
adLockUnspecified it doesn't occur. By the way this error doesn't
occur when
I open Pubs database with any type of locking. What is a cause of this
error?
Thank you.#import "D:\Program Files\Common Files\System\ADO\msado15.dll" \
no_namespace rename("EOF", "EndOfFile")
int main()
{
CoInitialize(NULL);

bstr_t strCnn("Provider=sqloledb;Data Source=;"
"Initial Catalog=testdb;Trusted_Connection=YES;");

const char* tablename = "testtable";

_RecordsetPtr recs;
recs.CreateInstance(__uuidof(Recordset) );
recs -> Open(tablename, strCnn, adOpenStatic,
adLockOptimistic,adCmdTable);
bool r = recs -> Supports(adBookmark);
_variant_t bm = recs -> Bookmark; // the error occurs here
recs -> Close();
CoUninitialize();
}

If I opened testdb then recs -> Supports(adBookmark)
returned true when I used adLockReadOnly or adLockUnspecified. If I
used other
LockTypes then this function returned false and the error occured in
this line:
__variant_t bm = recs -> Bookmark; // the error occurs here

If I opened the Pubs database then recs -> Supports(adBookmark)
returned true for any LockType. Why does a Recordset object support
bookmark functionality for any LockType if I open the Pubs database?!
I can't understand it!!!

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
>

Thursday, February 16, 2012

ADO error: Invalid object name <object name>.

I tried to create a report that is based on a stored procedure and I get this error when I try to verify the SQL.

ADO error: Invalid object name '#MatPatAbsence'.

If I click on the RUN exclaimation mark, I get no data, but do get the column names.

#MatPatAbsence is a temporary table created in the stored procedure and deleted once used.

I have also created another similar report from a stored procedure that has temporary tables and all are working fine.

also this stored procedure runs fine in query analyzer.

Can any one help please?

paste your query, I will take a look

ADO Connections

Forgive me if this is the wrong forum, but it does have to do with data access. Just a quick question: When using an ADO Component /Object to connect to a database, C# or whatever, that connection that is established - How likely is it that data being retrieved from the database is intercepted, is that channel encrypted/secured, and if not for either questions, how do i secure that channel?

Please check following blog:

http://blogs.msdn.com/sql_protocols/archive/2005/10/04/476705.aspx

If you want to force client encryption, there is a connection string property in ADO, please see below link:

http://msdn2.microsoft.com/en-us/library/system.data.sqlclient.sqlconnection.connectionstring.aspx

good luck!

Ming.

Monday, February 13, 2012

ADO Connection BeginTrans() CommitTrans() RollbackTrans()

Does anyone know of a way, using the ADO Connection object and SQLOLEDB Provider, to determine if that connection is currently in a transaction. I'm coding in C++.I was not able to find a way

i had to encapsulate anything related to DB connections into a class, and had an instance variable store where a transaction was active.|||Yeah, that's what we did too. I guess the design mistake we made was sharing 1 connection accross multiple instances of this class. I guess we could change the m_bTrans member to be static.

Thanks,