VC修改Access密码
void ModifyDBCode()
{
CString strPath;
::GetModuleFileName(GetModuleHandle(NULL),strPath.GetBuffer(256),256);
strPath.ReleaseBuffer();
int flag=strPath.ReverseFind('\\');
int size=strPath.GetLength();
strPath.Delete(flag,size-flag);
strPath= strPath+ _T("\\test.mdb"); //数据库名称
CString strConn=_T("Provider=Microsoft.ACE.OLEDB.12.0;User ID=Admin;Data Source=");
CString buf=strPath;
ASSERT(buf != _T(""));
strConn+=buf;
strConn+=_T(";Jet OLEDB:Database Password = ");
strConn+= g_strPassword;
strConn+=_T(";Mode=Share Deny Read|Share Deny Write"); // du zhan fang shi da kai
CADODatabase pAdoDb;
pAdoDb.SetConnectionString(strConn);
if(!pAdoDb.Open()) return;
CString strExe = _T("ALTER DATABASE PASSWORD [");
strExe += m_strNewCode;
strExe += _T("] [");
strExe += g_strPassword;
strExe += _T("]");
pAdoDb.Execute(strExe);
}
相关文档:
SQLConfigDataSource
创建ODBC数据源可以调用Windows系统子目
录下的动态链接库Odbcint.dll中的函数SQLConfigDataSource()
该函数可以动态地增加、修改和删除
数据源。
SQLConfigDataSource()函数
SQLConfigDataSource()的原型如下:
BOOL SQLConfigDataSource(HWND hwndParent, UINT
fRequest ......
转自:http://dev.yesky.com/243/2230743.shtml
ADO(ActiveX Data Object)是Microsoft数据库应用程序开发的新接口,是建立在OLE DB之上的高层数据库访问技术,即使你对OLE DB,COM不了解也能轻松对付ADO,因为它非常简单易用,甚至比你以往所接触的ODBC API、DAO、RDO都要容易使用,并不失灵活性。本文详细地介绍在Visual C ......
更新方法一,直接在GridView中来更新数据.
更新方法二,打开一个新的页面来更新数据.
//更新
protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
{
GridView1.EditIndex = e.NewEditIndex;
&nbs ......
if (currentPage ==1) {
//如果当前页为第1页
sql ="select top "+pageSize+" * from Table";
} else {
int start =(currentPage -1)*pageSize;
sql ="select top "+pageSize+" * from Table where ID not in (select top "+start+" ID from Table)";
} ......