Wednesday, March 7, 2012
Application Role with vb
I connect to sql server by windows authentication.
I setup each login to public role of database.
In Database , i add application role and set permission via application
role.
When VB App connect to database , it use windows authentication.
Before It connectd , i call stored procedure (sp_setapprole) to database.
It work fine except that if i use boundcolumn to control in form.
it's occure error for consequent code try to select data from table.
It warn that "permission denied".
Thanks in advanceIt's not work yet.
But i close recordset of bound column, it can select data but bound column
can not see data.
"Dan Guzman" <danguzman@.nospam-earthlink.net> wrote in message
news:eH6bONNeDHA.1832@.TK2MSFTNGP09.phx.gbl...
> It may be that connection pooling is resetting the connection so you
> lose the app role security context. Assuming you're using SQLOLEDB, try
> disabling connection pooling by including ';OLE DB Services=-2' in your
> connection string. For example:
> Provider=SQLOLEDB;Data Source=MyServer;Integrated Security=SSPI;Persist
> Security Info=False;;OLE DB Services=-2
> --
> Hope this helps.
> Dan Guzman
> SQL Server MVP
> --
> SQL FAQ links (courtesy Neil Pike):
> http://www.ntfaq.com/Articles/Index.cfm?DepartmentID=800
> http://www.sqlserverfaq.com
> http://www.mssqlserver.com/faq
> --
> "ton" <barameek@.inglife.co.th> wrote in message
> news:e5ydwCNeDHA.3204@.TK2MSFTNGP11.phx.gbl...
> > I use Application role with vb.
> > I connect to sql server by windows authentication.
> > I setup each login to public role of database.
> > In Database , i add application role and set permission via
> application
> > role.
> > When VB App connect to database , it use windows authentication.
> > Before It connectd , i call stored procedure (sp_setapprole) to
> database.
> > It work fine except that if i use boundcolumn to control in form.
> > it's occure error for consequent code try to select data from table.
> > It warn that "permission denied".
> >
> > Thanks in advance
> >
> >
> >
>
Saturday, February 25, 2012
Application hangs on SqlCeConnection.Dispose()
Hi,
I'm having the problem that my application hangs on SqlCeConnection.Dispose() when I'm closing the app.
public class DatabaseManager : IDisposable
{
private DbConnection connection = null;
// Singleton
private DatabaseManager()
{
this.CreateConnection();
}
~DatabaseManager()
{
this.Dispose();
}
public void Dispose()
{
if (this.connection != null)
{
this.connection.Dispose();
}
}
// ...
}
This only happens when I'm calling Application.Exit(); and Dispose is called through the destructor of the DatabaseManager class. When I'm disposing the connection during normal work the call works as intended. BTW I'm using SQL Server Mobile 3.0.5214.0 on a PPC 2003 AKU2 (Symbol PPT8846 industrial device).
Thanks for support,
Klaus
Your implementation is incorrect. There's some special handling involved if called from finalizer:
// Dispose(bool disposing) executes in two distinct scenarios.
// If disposing equals true, the method has been called directly
// or indirectly by a user's code. Managed and unmanaged resources
// can be disposed.
// If disposing equals false, the method has been called by the
// runtime from inside the finalizer and you should not reference
// other objects. Only unmanaged resources can be disposed.
private void Dispose(bool disposing)
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemIDisposableClassDisposeTopic.asp
Generally you don't need finalizer in this class as you don’t have any native resources.