Showing posts with label project. Show all posts
Showing posts with label project. Show all posts

Thursday, March 22, 2012

Accessing a web service using clr in SQL 2005

I need to access a billing webservice from SQL. I createde a new c# class project and made a web refrence to the web service "ProdBilling".

Here is the code of my assembly

using System.Data;
using Microsoft.SqlServer.Server;
using System.Data.SqlTypes;
namespace PaymentProc
{
public class PaymentProc
{
[Microsoft.SqlServer.Server.SqlProcedure]
public static void ChargeCard(int account, int amount)
{
string Response;
ProdBilling.Service serv = new ProdBilling.Service();
Response = serv.ChargeCard(account, amount);
SqlContext.Pipe.Send(Response);
}
}
}

I then ran WSDL

wsdl /oStick out tongueaymentProc.cs /nStick out tongueaymentProc http://ProdWeb1/PaymentProc/PaymentProc.asmx

Then compliled

csc /target:library PaymentProc.cs

and added the assembly
CREATE ASSEMBLY PaymentProc from 'D:\ProdCode\PaymentProc.dll' WITH
PERMISSION_SET = UNSAFE

I cannot figure out how to refrence the chargecard method

I have tried

CREATE PROCEDURE PaymentProc
@.Account int,
@.Amount int
AS
EXTERNAL NAME PaymentProc.[PaymentProc.PaymentProc].ChargeCard

It seems wsdl.exe put all this serialization code

namespace PaymentProc {
using System.Diagnostics;
using System.Web.Services;
using System.ComponentModel;
using System.Web.Services.Protocols;
using System;
using System.Xml.Serialization;

///
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Web.Services.WebServiceBindingAttribute(Name="ServiceSoap", Namespace="http://ProdWeb1/PaymentProc")]
public partial class PaymentProc : System.Web.Services.Protocols.SoapHttpClientProtocol {

private System.Threading.SendOrPostCallback ChargeCardOperationCompleted;

///
public PaymentProc()
{
this.Url = "http://ProdWeb1/PaymentProc/PaymentProc.asmx";
}

///
public event ChargeCardCompletedEventHandler ChargeCardCompleted;

///
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://ProdWeb1/PaymentProc/ChargeCard", RequestNamespace="http://ProdWeb1/PaymentProc", ResponseNamespace="http://ProdWeb1/PaymentProc", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public string ChargeCard(int account, int amount) {
object[] results = this.Invoke("ChargeCard", new object[] {
account,
amount});
return ((string)(results[0]));
}
.................

When I run

CREATE PROCEDURE PaymentProc
@.Account int,
@.Amount int
AS
EXTERNAL NAME PaymentProc.[PaymentProc.PaymentProc].ChargeCard

I get error

Method, property or field 'ChargeCard' of class 'PaymentProc.PaymentProc' in assembly 'PaymentProc' is not static.

Any ideas? This seemsed so straitforward in the beginning.

Change your ChargeCard CLR method (the one you are marking as a proc) to some other name, and then change the CREATE PROCEDURE statement to use that changed name. That should hopefully do it.

Niels
|||

I think my problem originates from the fact that you cannot complie an assembly using a web refrence using csc. I redesigned my assembly with a web refrence to http://ProdWeb1/PaymentProc/PaymentProc.asmx called ProdBilling which I can test operation ChargeCard successfully.

using System;

using System.Collections.Generic;

using System.Text;

namespace PayProcAssembly

{

public class PaymentProcessing

{

[Microsoft.SqlServer.Server.SqlProcedure]

public static string ChargeCard(int Account, float Amount)

{

ProdBilling.PayProcessing serv = new ProdBilling.PayProcessing();

string result = serv.ChargeCard(Account, Amount);

SqlContext.Pipe.Send(result);

}

}

}

When I run

csc /target:library PaymentProcessing.cs

I get

Error: The type or namespace name 'ProdBilling could not be found (are you missing a using directive or an assembly reference?)

I was told I needed to create a proxy using WSDL.exe but it seems when I ran

wsdl /o PaymentProc.cs /n PaymentProc http://ProdWeb1/PaymentProc/PaymentProc.asmx

It messed up my code. I cant even find the web refrence anymore. Is this correct that I have to use wsdl or is there an easier way?

Accessing a web service using clr in SQL 2005

I need to access a billing webservice from SQL. I createde a new c# class project and made a web refrence to the web service "ProdBilling".

Here is the code of my assembly

using System.Data;
using Microsoft.SqlServer.Server;
using System.Data.SqlTypes;
namespace PaymentProc
{
public class PaymentProc
{
[Microsoft.SqlServer.Server.SqlProcedure]
public static void ChargeCard(int account, int amount)
{
string Response;
ProdBilling.Service serv = new ProdBilling.Service();
Response = serv.ChargeCard(account, amount);
SqlContext.Pipe.Send(Response);
}
}
}

I then ran WSDL

wsdl /oStick out tongueaymentProc.cs /nStick out tongueaymentProc http://ProdWeb1/PaymentProc/PaymentProc.asmx

Then compliled

csc /target:library PaymentProc.cs

and added the assembly
CREATE ASSEMBLY PaymentProc from 'D:\ProdCode\PaymentProc.dll' WITH
PERMISSION_SET = UNSAFE

I cannot figure out how to refrence the chargecard method

I have tried

CREATE PROCEDURE PaymentProc
@.Account int,
@.Amount int
AS
EXTERNAL NAME PaymentProc.[PaymentProc.PaymentProc].ChargeCard

It seems wsdl.exe put all this serialization code

namespace PaymentProc {
using System.Diagnostics;
using System.Web.Services;
using System.ComponentModel;
using System.Web.Services.Protocols;
using System;
using System.Xml.Serialization;

///
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Web.Services.WebServiceBindingAttribute(Name="ServiceSoap", Namespace="http://ProdWeb1/PaymentProc")]
public partial class PaymentProc : System.Web.Services.Protocols.SoapHttpClientProtocol {

private System.Threading.SendOrPostCallback ChargeCardOperationCompleted;

///
public PaymentProc()
{
this.Url = "http://ProdWeb1/PaymentProc/PaymentProc.asmx";
}

///
public event ChargeCardCompletedEventHandler ChargeCardCompleted;

///
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://ProdWeb1/PaymentProc/ChargeCard", RequestNamespace="http://ProdWeb1/PaymentProc", ResponseNamespace="http://ProdWeb1/PaymentProc", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public string ChargeCard(int account, int amount) {
object[] results = this.Invoke("ChargeCard", new object[] {
account,
amount});
return ((string)(results[0]));
}
.................

When I run

CREATE PROCEDURE PaymentProc
@.Account int,
@.Amount int
AS
EXTERNAL NAME PaymentProc.[PaymentProc.PaymentProc].ChargeCard

I get error

Method, property or field 'ChargeCard' of class 'PaymentProc.PaymentProc' in assembly 'PaymentProc' is not static.

Any ideas? This seemsed so straitforward in the beginning.

Change your ChargeCard CLR method (the one you are marking as a proc) to some other name, and then change the CREATE PROCEDURE statement to use that changed name. That should hopefully do it.

Niels
|||

I think my problem originates from the fact that you cannot complie an assembly using a web refrence using csc. I redesigned my assembly with a web refrence to http://ProdWeb1/PaymentProc/PaymentProc.asmx called ProdBilling which I can test operation ChargeCard successfully.

using System;

using System.Collections.Generic;

using System.Text;

namespace PayProcAssembly

{

public class PaymentProcessing

{

[Microsoft.SqlServer.Server.SqlProcedure]

public static string ChargeCard(int Account, float Amount)

{

ProdBilling.PayProcessing serv = new ProdBilling.PayProcessing();

string result = serv.ChargeCard(Account, Amount);

SqlContext.Pipe.Send(result);

}

}

}

When I run

csc /target:library PaymentProcessing.cs

I get

Error: The type or namespace name 'ProdBilling could not be found (are you missing a using directive or an assembly reference?)

I was told I needed to create a proxy using WSDL.exe but it seems when I ran

wsdl /o PaymentProc.cs /n PaymentProc http://ProdWeb1/PaymentProc/PaymentProc.asmx

It messed up my code. I cant even find the web refrence anymore. Is this correct that I have to use wsdl or is there an easier way?

Tuesday, March 20, 2012

Accessing a database from another project

Hay there,

I have an asp.net project website with an sql Database. I need to access this same database from another project (a class library that needs to access this database). In fact i want to be able to use the tableadapters that I have implemented for my database in this new class library..

I guess it has to do something with making my database not part of the website but and independemt entitiy that can be seen by others.... I cannot seem to find a way to do that can anyone help meee ??

Thanks for your time!

If its a database then how is it tied to application.

Atleast It must have the mdf files which you can create a real independent entity and then play wiith it using connection strings.

|||

All your databases resides in a databse server (e.g. MS SQL Server 2005).

What you need is to point your ConnectionString from your application to that database.

My guess is, you have two projects (e.g. ProjectA and ProjectB) and thay are using diffrent databases but in some part of ProjectB needs to use the same database of ProjectA.

So, you should have two ConnectionStrings for ProjectB. One you will use it for most part of the project and it is specific to ProjectB (keep it in Web.Config file) while you need another ConnectionString that will access the database (which ProjectA is using it) from ProjectB.

Here, have another ConnectionString in the web.config file of ProjectB and lets it point to the same database used by ProjectA.

Good luck.

|||

Hi,

Thanks for your very clear reply and clarification.

I can't seem to apply your reply to my situation as My project B is just a class library i.e. I have no webconfig ...

Note that project A and Project B are part of the same solution too.

Thanks for your help.

|||

Hi ekosha,

Why you have the databse within the project itself?!

|||

Well good question, Well I was just implementing this application then and didn't think I would need to use it from another project. seems that was a wrong decision any idea how I can fix that?

|||

ekosha:

Well good question, Well I was just implementing this application then and didn't think I would need to use it from another project. seems that was a wrong decision any idea how I can fix that?

This database has a file with .mdf extension, take that file and attached to a new database in MS SQL Server.

Now, you can use that database for all your projects (even if they are within one solution).

Good luck.

Accessing a .dbf file in SQL Server 2000

I am new to SQL Server 2000, and anxious to get started. I'm beginning with a project that will use a file saved in the .dbf(dBase) format.

I looked in the Books on Line under 'OLEDB Provider' and didn't find any help about dbf files. I did use the 'OLEDB Provider for Jet' example to create a linked server that accessed an Excel spreadsheet.

Can someone give me some pointers in accessing my dbf file in SQL Server 2000?

Thanks for any help.

Randyyou can create an odbc datasource and then set up a linked server with the 'ole db for odbc' driver. See in books online for more info.

Tuesday, March 6, 2012

Access to MSDE database

Hi
I am just starting my first .NET project using the web matrix and an MSDE database. I am pretty much at the limit of my knowledge - all very interesting. I have some data in an Access spreadsheet (6 columns and 365 rows) which in the past I have copied and pasted into an Access database table. How do I get it into a MSDE database table? This process does not need to be automated/programmed as I will only have to do it once a year. Any ideas on the easiest way forward would be much appreciated.
Thanks in advance.
MikeUse the Upsizing Wizard in Access. Tools/Database Utilities/Ubsizig Wizard, as I recall.|||Douglas
Very many thanks for the advise - it got me going along the righttracks. In the end I used File/Export (which seemed well suitedto transfering data in a single table). I had to configure someODBC connections (which took me a while to understand and setup). Anyway, it seems to work now.
Thanks again.
Mike

Access to "C:/etc/etc/etc.rptproj.user" is denied

Hi All!!

I have recently come across the following problem when attempting to access the solution file for the project in question. I double click to access the file and VS2003 fires up, only for it to give me the above warning. At which point nothing is loaded in the tree!

When I check things out they do show up in Source Safe but if I need to add any new reports (which I do), I am unable to add them...

Cany anyone shed any light on the matter?

Thanks a million!!

I believe this answers your question:

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=988559&SiteID=1

|||Issue been resolved thanks for the suggestion

Access tables transferred to SQL Server are set to "read only." How do I correct/

I created an Access project and transferred some tables from my .mdb Access
database into an existing SQL Server database. Now, the tables are "read
only" meaning that I can't add/modify/delete data in the tables. But, when
I open the same SQL Server database, from the same desktop, using EM I can
add/modify/delete data in the SAME table.
Where should I look?
TIA,
Larry WoodsCreate a primary key/unique index on the tables in question. Access
refuses to update SQLS tables otherwise.
--Mary
On Wed, 28 Jul 2004 07:18:35 -0700, "Larry Woods"
<larry@.NOSPAMlwoods.com> wrote:
>I created an Access project and transferred some tables from my .mdb Access
>database into an existing SQL Server database. Now, the tables are "read
>only" meaning that I can't add/modify/delete data in the tables. But, when
>I open the same SQL Server database, from the same desktop, using EM I can
>add/modify/delete data in the SAME table.
>Where should I look?
>TIA,
>Larry Woods
>

Access tables transferred to SQL Server are set to "read only." How do I correc

I created an Access project and transferred some tables from my .mdb Access
database into an existing SQL Server database. Now, the tables are "read
only" meaning that I can't add/modify/delete data in the tables. But, when
I open the same SQL Server database, from the same desktop, using EM I can
add/modify/delete data in the SAME table.
Where should I look?
TIA,
Larry Woods
Create a primary key/unique index on the tables in question. Access
refuses to update SQLS tables otherwise.
--Mary
On Wed, 28 Jul 2004 07:18:35 -0700, "Larry Woods"
<larry@.NOSPAMlwoods.com> wrote:

>I created an Access project and transferred some tables from my .mdb Access
>database into an existing SQL Server database. Now, the tables are "read
>only" meaning that I can't add/modify/delete data in the tables. But, when
>I open the same SQL Server database, from the same desktop, using EM I can
>add/modify/delete data in the SAME table.
>Where should I look?
>TIA,
>Larry Woods
>

Access tables transferred to SQL Server are set to "read only." How do I co

I created an Access project and transferred some tables from my .mdb Access
database into an existing SQL Server database. Now, the tables are "read
only" meaning that I can't add/modify/delete data in the tables. But, when
I open the same SQL Server database, from the same desktop, using EM I can
add/modify/delete data in the SAME table.
Where should I look?
TIA,
Larry WoodsCreate a primary key/unique index on the tables in question. Access
refuses to update SQLS tables otherwise.
--Mary
On Wed, 28 Jul 2004 07:18:35 -0700, "Larry Woods"
<larry@.NOSPAMlwoods.com> wrote:

>I created an Access project and transferred some tables from my .mdb Access
>database into an existing SQL Server database. Now, the tables are "read
>only" meaning that I can't add/modify/delete data in the tables. But, when
>I open the same SQL Server database, from the same desktop, using EM I can
>add/modify/delete data in the SAME table.
>Where should I look?
>TIA,
>Larry Woods
>

Access SSAS 2005 Data from Java

I have a C# ASP.NET 2.0 application that is using ADOMD to access my cube data in SSAS and it works very well.

I have another project in Java and would like to integrate SSAS cube data. Is this possible? I know Microsoft makes SQL Server drivers for Java. Is there anything like ADOMD for Java? If not, is there a OLAP type tool that is similar to SSAS that is Java friendly?

I know Java and Microsoft are usually competing and incompatible technologies. Please don't tell me to switch or turn this into a political thread.

Any tips are greatly appreciated.

Thanks in advance!
use XMLA. there are plenty of opensource solutions and examples it about.|||

Here are links to two good open source tools which use Java to access Analysis Services through XMLA:

1. JPivot http://jpivot.sourceforge.net/

2. REX http://sourceforge.net/projects/whex/

Access SSAS 2005 Data from Java

I have a C# ASP.NET 2.0 application that is using ADOMD to access my cube data in SSAS and it works very well.

I have another project in Java and would like to integrate SSAS cube data. Is this possible? I know Microsoft makes SQL Server drivers for Java. Is there anything like ADOMD for Java? If not, is there a OLAP type tool that is similar to SSAS that is Java friendly?

I know Java and Microsoft are usually competing and incompatible technologies. Please don't tell me to switch or turn this into a political thread.

Any tips are greatly appreciated.

Thanks in advance!use XMLA. there are plenty of opensource solutions and examples it about.|||

Here are links to two good open source tools which use Java to access Analysis Services through XMLA:

1. JPivot http://jpivot.sourceforge.net/

2. REX http://sourceforge.net/projects/whex/

Saturday, February 25, 2012

access SQL Server from application

Hi,

I have recently transfered data from MS Access to MS SQL Server 2000 and created user interface in MS Access Project (ADP). Now I need to secure the data on server and want to access it ONLY through interface I created in MS Access. Every user has to log in the application (user id and password). Users may have the same access rights to the server (so maybe just one account or whatever I need for all of them). Can anyone advice me how to set it up? To access sql server from MS Access I am using ADO.

Thank you.
djLookup "Application Roles" in Books Online.

But be aware that it is better practice to limit your to establish security at the data level than the application level. Establishing Application Roles is no substitute for making sure that your database is locked down.|||Yes, I agree. I have no experience with SQL Server. In MS Access it was easy. So, how to lock down database. What I should create there to secure data? Any password? And then I need to access data through ADO. There is connection string where I have to pass a password.

Could you help me to clarify that.
Thanks
dj

Friday, February 24, 2012

Access Projects, SQL Server, and 1-to-1 joins

Hello everyone,

I'm working on porting an Access Application with linked tables to an Access Project, to make it faster. The backend is (unsurprisingly) MS SQL Server.

My problem is thisL:

I have a form (well, several forms) which are sourced from a 1 - 1 join
Person <-> Candidate

It seems that I can only edit one of these tables at a time, the one specified by the UniqueTable property. I want to have access to the whole record at once. In the Access documentation, it doesn't seem to mention this case, which seems a little odd.

Adding records is not a problem, it's only updating, and it can be guaranteed that a Clienta and Person record both exist.

I don't think I can enforce referential integrety, as Person also links to Client, so a Person record might not match to a Candidate record.

How can I set up the database or form to permit the editing of both tables simulatenously?

Thanks,
SamJust a suggestion but while you are porting this thing over why not de-normalize these tables into one table with a Type field (person, client, candidate)?

This will make life much easier...|||The structure is basically trying to mimic OO inheritance. The problem is that Candidates and Clients have too many similar fields to be put into completely separate tables (it would also make _really_ wide tables, which is a bit of a no-no), but too many different fields to make one table. apart from an even wider table, there would be heaps of empty fields.

While it would be easer, sometimes the easiest solution isn't the best. And it seems completely ridiculous that this is an unsolvable problem. I mean, it worked just fine in Jet, why not in it's bigger brother?|||Hi,
I was searching and found your thread. I am having the exact same problem. I have a "Person" table and other subtypes of it like "Contatc".
On my contact form I have a record source with a 1-1 join on tblContact and tblPerson (when a user is inserting a contact a VB code would insert the new assigned number from the Person table to the Contact table)

Now that I'm trying to use Access projects it won't work. Its driving me nuts. I've tried every trick I know and it won't work.

By the way I am very suprised that my ODBC connection is much faster than my Access project, at least for data entry. When I'm using Access project and when I start typing in a field it pause for a second and then the characters apear. Thats wierd, do you know any thing about it?

Originally posted by Digitaleus
The structure is basically trying to mimic OO inheritance. The problem is that Candidates and Clients have too many similar fields to be put into completely separate tables (it would also make _really_ wide tables, which is a bit of a no-no), but too many different fields to make one table. apart from an even wider table, there would be heaps of empty fields.

While it would be easer, sometimes the easiest solution isn't the best. And it seems completely ridiculous that this is an unsolvable problem. I mean, it worked just fine in Jet, why not in it's bigger brother?|||Answer is as simple as bad: it can't be done. You can only update the table specified by UniqueTableProperty (which must be set programmatically if you use storep procedures, btw).

There are mainly two ways to get around this:
a) split the form in two, syncing them on the appropriate id and update form-wise or
b) use unbound forms and display/update programatically.

Which one is less inconvinient depends on your specific needs.|||You mean instead of having a join query as the record source of the form, us a wizard to sync them (we can also drag and drop)?

Thanks

Originally posted by chrisp_999
Answer is as simple as bad: it can't be done. You can only update the table specified by UniqueTableProperty (which must be set programmatically if you use storep procedures, btw).

There are mainly two ways to get around this:
a) split the form in two, syncing them on the appropriate id and update form-wise or
b) use unbound forms and display/update programatically.

Which one is less inconvinient depends on your specific needs.|||Assume you have frm_person and frm_contact as subform of frm_contact.

Datasource for frm_contact is
select * from tbl_person

Assumed you have a field ID in tbl_person, datasource for frm_contact is

select * from tbl_contact where personID = @.ID

and the Input Parameter property for frm_contact is

@.ID int = forms!frm_person!ID
(or txt_ID or whatever the name of the field is)

Anytime the record on frm_person is changed, issue (in VBA)
forms!frm_contact.requery.

That's the basic scheme. Details vary depending on wether you have an endless form or not and so on.

BTW, with MSSQL you can use a trigger to create the entry in tbl_contact instead of VBA. So you ensure data integrity within the database (e.g. if you insert manually).|||correction :-/

forms!frm_contact.requery must read forms!frm_person!frm_contact.form.requery

as frm_contact is a subform ...

I should reread before posting.|||Thanks

Originally posted by chrisp_999
correction :-/

forms!frm_contact.requery must read forms!frm_person!frm_contact.form.requery

as frm_contact is a subform ...

I should reread before posting.

Access Project with MSDE2000

Hi Gurus,
I've got a question when using Access Project with MSDE2000. I can properly install MSDE and connect a Access Project with master database, but I can't create table or modify table structure, is there any thing wrong?
My os is XP, and Access 2000.
Thanks in advance
You probably dont want to be creating tables within the master db anyway.
When you load Access, chose 'Project (New Data)'. This should allow you to
create your own db, which you should be able to create tables in...
Cheers,
James Goodman
"Frank" <anonymous@.discussions.microsoft.com> wrote in message
news:4F160968-BBDD-4BEE-A13D-03ED349A3659@.microsoft.com...
> Hi Gurus,
> I've got a question when using Access Project with MSDE2000. I can
properly install MSDE and connect a Access Project with master database, but
I can't create table or modify table structure, is there any thing wrong?
> My os is XP, and Access 2000.
> Thanks in advance
>

access project front end and SPs

Hi,
I have recently upsized an Access database to SQLServer. This has required
me rewriting the majority of the queries.
My question is this: How do I reference a control on an Access form in an
SP. (I have a query whose WHERE statement requires a value input by the user
on a form).
Many Thanks,
PeteThe SP can NOT reference a control on a form... In the form you must call
the sp passing the control's value as a parameter to the sp
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"Italian Pete" <ItalianPete@.discussions.microsoft.com> wrote in message
news:4B22054F-3043-4F39-979E-C88A747A01A6@.microsoft.com...
> Hi,
> I have recently upsized an Access database to SQLServer. This has
> required
> me rewriting the majority of the queries.
> My question is this: How do I reference a control on an Access form in an
> SP. (I have a query whose WHERE statement requires a value input by the
> user
> on a form).
> Many Thanks,
> Pete|||You should be able to use a Pass-through Query from Access --> SQL - filling
the parameters on the FE and passing the query call to SQL. The sp itself
can't reference the FE controls.
"Italian Pete" wrote:

> Hi,
> I have recently upsized an Access database to SQLServer. This has requir
ed
> me rewriting the majority of the queries.
> My question is this: How do I reference a control on an Access form in an
> SP. (I have a query whose WHERE statement requires a value input by the us
er
> on a form).
> Many Thanks,
> Pete|||Wayne,
What would the syntax for passing the controls as parameters be? ( I can't
seem to find a reference to it in the Access help files).
"Wayne Snyder" wrote:

> The SP can NOT reference a control on a form... In the form you must call
> the sp passing the control's value as a parameter to the sp
> --
> Wayne Snyder, MCDBA, SQL Server MVP
> Mariner, Charlotte, NC
> www.mariner-usa.com
> (Please respond only to the newsgroups.)
> I support the Professional Association of SQL Server (PASS) and it's
> community of SQL Server professionals.
> www.sqlpass.org
> "Italian Pete" <ItalianPete@.discussions.microsoft.com> wrote in message
> news:4B22054F-3043-4F39-979E-C88A747A01A6@.microsoft.com...
>
>|||On a forms properties list (for example) is an item called "Input Parameters
"
You could put the values there, it takes some fiddling to get the order
right if you were going to use the onOpen event of the form to read in the
values from controls
eg:
Me.InputParameters = "@.a_variable a_datatype(a_length) = 'a_value'"
Me.RecordSource = "a_sproc_name"
Me.OrderByOn = True
Me.OrderBy = "a_field, another_field"
Me.UniqueTable = "table_name_to_be_updated"
real:
Me.InputParameters = "@.TYPE varchar(25) = 'My_Text'"
Me.RecordSource = "sp_Do_Some"
Me.OrderByOn = true
Me.OrderBy = "Year"
Me.UniqueTable = "tbl_Main"
"Italian Pete" wrote:
> Wayne,
> What would the syntax for passing the controls as parameters be? ( I can't
> seem to find a reference to it in the Access help files).
> "Wayne Snyder" wrote:
>

Access project connecting to SQL 2005

Most of our users are using MS Access project to work with our data in SQL Server 2005. The problem we have is that in order for them to access the tables they need to be given db_datareader and db_datawriter permission on the database. Our goal is not to give access to the tables themselves but to views. Therefore, we've created several views and placed them into a particular schema. Now we want to give access to that schema, but when we assign select, delete, insert, and update to that schema user in ms access project aren't able to view these tables. When we give them db_datareader permission they are able to see the views but in parentencies does not show the correct schema; therefore, when you try to open that view it errors out saying it doesn't exist. Also since they now have db_datareader they are also able to access the other view and tables in the database.

What we are looking to do is give our Access Project users the permission to link to SQL Server 2005 views by schema only.

I don't fully understand the issue that you hit, but here's an example of how you can separate tables and views in different schemas and grant permission on the views schema, so that a user can select from the views, but not from the tables:

-- create a test database and a test login&user
--
create database test

use test

create login alice with password = 'Vl&cptn1cf0'

create user alice

-- create separate schemas for tables and views
--
create schema sch_tables

create schema sch_views

-- create a table and a view that selects from it
-- select will work due to ownership chaining
-- because both schemas are owned by dbo
--
create table sch_tables.t (answer int)

insert into sch_tables.t values (42)

create view sch_views.v as select * from sch_tables.t

-- allow alice to select from the schema sch_views
--
grant select on schema::sch_views to alice

-- now test that alice can select from view but not from table
--
execute as login = 'alice'

-- this select will work
--
select * from sch_views.v

-- this select will fail
--
select * from sch_tables.t

-- revert impersonation of alice
--
revert

-- cleanup
--
use master

drop database test

drop login alice

Thanks
Laurentiu

|||

Thanks for the reply but we have done what you are suggesting and it works great when you access through Management Studio. Our users are using MS Access projects. Maybe I am missing a step but if we don't give db_datareader they won't even see these views and when they do have db_datareader all objects that do not have the "dbo" schema doesn't seem to work. It will show another schema entirely. It looks like a login name and not necessarily yours.

We're talking about installing Access 2007 but I don't know when. Maybe it will work better. I did test the beta version and it appears to work but the new Access environment is so much different and only being a casual user of Access I don't know if there are any other problems.

|||

How does Access connect to SQL Server?

Are you granting SELECT on the schema to the same user that you are adding to the db_datareader role?

Thanks
Laurentiu

|||

Yes, after I moved the views into the schema I then granted the user select, update, insert, and delete permissions on that schema. I am connecting with ADO from MS Access (file|connection). I am not able to see these views or any other views unless i grant db_datareader. Even when I do give db_datareader though you only able to access (open) views with the dbo schema. The other views with different schemas show up but with an invalid schema name which doesn't exist.

Therefore, for now I have to everyone db_datareader so they can atleast link to these views with MS Access. They won't be able to update, insert, or delete unless they also have the other permissions.

I just don't know if SQL is setting incorrectly or it is just a bug.

|||

Can you post a sample script that shows what you did?

What do you mean by not being able to see the views? Can you post the error message that you received?

Also, where do the views show up with an invalid schema? Have you checked the schema name using the catalogs using a query such as the following:

select schema_name(schema_id) from sys.objects where name = 'view_name'

Thanks
Laurentiu

|||

Apparently it is an MS Access 2002/2003 problem. MS Access 2002/2003 does not handle schemas at all. I got approval today to start rolling out MS Access 2007 so this will eliminate the problem.

Thanks for sparing your time.

|||

I'm having a similar problem. Specifically, when I change a table's schema, in SQL Server, from dbo to anything else I can no longer see the table in my Access 2003 project. I used the "Data Link Properties" dialog available on the File->Connections... menu. The error I get in Access is "Table '<tablename>' no longer exists in the database", of course it does still exist.

If I use the "Link Tables Wizard" in Access to create a link to a table in SQL Server with an other-than-dbo schema I get the error "An invalid schema or catalog was specified for the provider "SQLNCLI" for linked server "<servername>", of course it is a valid schema.

I've tried everything to try to find a blurb from Microsoft discussing this issue, but I can't find anything addressing this problem. I suspect, as the previous post says, that Access 2003 simply cannot handle other-than-dbo schemas in SQL Server.

SO, my question is how do you know that Access 2003 doesn't support other-than-dbo schemas in SQL Server? Do you know of a statement from Microsoft that addresses this problem?

Access project connecting to SQL 2005

Most of our users are using MS Access project to work with our data in SQL Server 2005. The problem we have is that in order for them to access the tables they need to be given db_datareader and db_datawriter permission on the database. Our goal is not to give access to the tables themselves but to views. Therefore, we've created several views and placed them into a particular schema. Now we want to give access to that schema, but when we assign select, delete, insert, and update to that schema user in ms access project aren't able to view these tables. When we give them db_datareader permission they are able to see the views but in parentencies does not show the correct schema; therefore, when you try to open that view it errors out saying it doesn't exist. Also since they now have db_datareader they are also able to access the other view and tables in the database.

What we are looking to do is give our Access Project users the permission to link to SQL Server 2005 views by schema only.

I don't fully understand the issue that you hit, but here's an example of how you can separate tables and views in different schemas and grant permission on the views schema, so that a user can select from the views, but not from the tables:

-- create a test database and a test login&user
--
create database test

use test

create login alice with password = 'Vl&cptn1cf0'

create user alice

-- create separate schemas for tables and views
--
create schema sch_tables

create schema sch_views

-- create a table and a view that selects from it
-- select will work due to ownership chaining
-- because both schemas are owned by dbo
--
create table sch_tables.t (answer int)

insert into sch_tables.t values (42)

create view sch_views.v as select * from sch_tables.t

-- allow alice to select from the schema sch_views
--
grant select on schema::sch_views to alice

-- now test that alice can select from view but not from table
--
execute as login = 'alice'

-- this select will work
--
select * from sch_views.v

-- this select will fail
--
select * from sch_tables.t

-- revert impersonation of alice
--
revert

-- cleanup
--
use master

drop database test

drop login alice

Thanks
Laurentiu

|||

Thanks for the reply but we have done what you are suggesting and it works great when you access through Management Studio. Our users are using MS Access projects. Maybe I am missing a step but if we don't give db_datareader they won't even see these views and when they do have db_datareader all objects that do not have the "dbo" schema doesn't seem to work. It will show another schema entirely. It looks like a login name and not necessarily yours.

We're talking about installing Access 2007 but I don't know when. Maybe it will work better. I did test the beta version and it appears to work but the new Access environment is so much different and only being a casual user of Access I don't know if there are any other problems.

|||

How does Access connect to SQL Server?

Are you granting SELECT on the schema to the same user that you are adding to the db_datareader role?

Thanks
Laurentiu

|||

Yes, after I moved the views into the schema I then granted the user select, update, insert, and delete permissions on that schema. I am connecting with ADO from MS Access (file|connection). I am not able to see these views or any other views unless i grant db_datareader. Even when I do give db_datareader though you only able to access (open) views with the dbo schema. The other views with different schemas show up but with an invalid schema name which doesn't exist.

Therefore, for now I have to everyone db_datareader so they can atleast link to these views with MS Access. They won't be able to update, insert, or delete unless they also have the other permissions.

I just don't know if SQL is setting incorrectly or it is just a bug.

|||

Can you post a sample script that shows what you did?

What do you mean by not being able to see the views? Can you post the error message that you received?

Also, where do the views show up with an invalid schema? Have you checked the schema name using the catalogs using a query such as the following:

select schema_name(schema_id) from sys.objects where name = 'view_name'

Thanks
Laurentiu

|||

Apparently it is an MS Access 2002/2003 problem. MS Access 2002/2003 does not handle schemas at all. I got approval today to start rolling out MS Access 2007 so this will eliminate the problem.

Thanks for sparing your time.

|||

I'm having a similar problem. Specifically, when I change a table's schema, in SQL Server, from dbo to anything else I can no longer see the table in my Access 2003 project. I used the "Data Link Properties" dialog available on the File->Connections... menu. The error I get in Access is "Table '<tablename>' no longer exists in the database", of course it does still exist.

If I use the "Link Tables Wizard" in Access to create a link to a table in SQL Server with an other-than-dbo schema I get the error "An invalid schema or catalog was specified for the provider "SQLNCLI" for linked server "<servername>", of course it is a valid schema.

I've tried everything to try to find a blurb from Microsoft discussing this issue, but I can't find anything addressing this problem. I suspect, as the previous post says, that Access 2003 simply cannot handle other-than-dbo schemas in SQL Server.

SO, my question is how do you know that Access 2003 doesn't support other-than-dbo schemas in SQL Server? Do you know of a statement from Microsoft that addresses this problem?

Access Project 2002 compatibility with SQL Server Express

Hi,

When using an Access Project 2002 connected with SQL Server Express in OLE DB it's impossible to work in creation mode. A message explains that this Access version is not compatible with this SQL version.

Is there a service pack ?

Unfortunately, no. By now Access Project cannot be used in design mode of SQL Express. Do note that the next verson of ms-access will fix this.