public static class AccessHelper
{
//数据库连接字符串
//WebForm
//public static readonly string conn_str = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + HttpContext.Current.Request.PhysicalApplicationPath + System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
//WinForm
//public static readonly string conn_str = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + AppDomain.CurrentDomain.BaseDirectory + System.Configuration.ConfigurationManager.ConnectionStrings["WZDFGL"].ConnectionString;
//public static readonly string conn_str = System.Configuration.ConfigurationManager.ConnectionStrings["WZDFGL"].ConnectionString;
public static readonly string conn_str = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + AppDomain.CurrentDomain.BaseDirectory + System.Configuration.ConfigurationManager.ConnectionStrings["WZDFGL"].ConnectionString + ";Persist Security Info= ......
public static class AccessHelper
{
//数据库连接字符串
//WebForm
//public static readonly string conn_str = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + HttpContext.Current.Request.PhysicalApplicationPath + System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
//WinForm
//public static readonly string conn_str = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + AppDomain.CurrentDomain.BaseDirectory + System.Configuration.ConfigurationManager.ConnectionStrings["WZDFGL"].ConnectionString;
//public static readonly string conn_str = System.Configuration.ConfigurationManager.ConnectionStrings["WZDFGL"].ConnectionString;
public static readonly string conn_str = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + AppDomain.CurrentDomain.BaseDirectory + System.Configuration.ConfigurationManager.ConnectionStrings["WZDFGL"].ConnectionString + ";Persist Security Info= ......
今天在用C#创建Access数据库的时候遇到了一个字段类型的问题,因为程序创建数据库表这个在SqlServer上比较常见,在百度中找了很久,把相关的属性抄录下来吧,以供以后使用。
1、动态创建Access数据库:本人觉得用ADOX的方式简单是简单,但是还是需要一个DLL组建方可以实现数据库的创建,所以那我们就换个思路吧,为什么不可以这样来呢。创建一个空白的数据库,之后通过程序去创建数据库的表,这样的效果不是也可以实现的?
2、动态创建Access数据库表:Create Table Admin (ID INT,UserName VarChar(50),UserPass VarChar(50)),这里遇到了字段属性的问题,具体的属性值请看下面的表吧。
----------------------------------------------------------------------------
类型名称 TYPE 备注
----------------------------------------------------------------------------
自动编号 integer ......
DB2ConnectionString
b2str = "Provider=MSDASQL.1;Password=a$sk6G7;Persist Security Info=True;User ID=DBA;Data Source=ConDB2SFXXK"
AccessConnectonString
accessstr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\DMSJK.mdb;Jet OLEDB:database password=" ......
DB2ConnectionString
b2str = "Provider=MSDASQL.1;Password=a$sk6G7;Persist Security Info=True;User ID=DBA;Data Source=ConDB2SFXXK"
AccessConnectonString
accessstr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\DMSJK.mdb;Jet OLEDB:database password=" ......
在Win7下安装完Foxmail6.5,退出程序并重新启动Foxmail后出现如下错误:
Access violation at address 007CC4B1 in module 'Foxmail.exe'. Read of address 00000014.
导致Foxmail不能启动,点击确定后仍会不断出现类似错误提示。
这可能是Foxmail在Win7下出现兼容性问题的缘故,可以在其“属性->兼容性”中选择以XP模式运行程序便不会出现上述错误了。
另外如果用管理员身份运行程序也不会出现启动错误的问题,这好像就不是兼容性的问题了。不过还是可以用了,呵呵!
......
using System;
using System.IO;
using System.Windows.Forms;
using Access = Microsoft.Office.Interop.Access;
// 添加引用->.NET-> dao,Microsoft.Office.Interop.Access
namespace WinFormAccess
{
public partial class FormAccess : Form
{
public FormAccess()
{
InitializeComponent();
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
try
{
string dbPath = Pa ......
using System;
using System.IO;
using System.Windows.Forms;
using Access = Microsoft.Office.Interop.Access;
// 添加引用->.NET-> dao,Microsoft.Office.Interop.Access
namespace WinFormAccess
{
public partial class FormAccess : Form
{
public FormAccess()
{
InitializeComponent();
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
try
{
string dbPath = Pa ......
在IE7中,当用户拖动或改变窗口大小时有可能出现类似这样的js脚本错误:
An error has occurred in the script on this page
Line: LineNumber
Char: CharacterNumber
Error: Access is denied. (拒绝访问)
Code: 0
URL: URL
这是由于IE7在安全方面的设计变更,当用户按下鼠标的时候,代码中正在执行的window.moveTo()或window.resizeTo()将发生异常,拒绝访问。在微软的知识库中有详细的描述:http://support.microsoft.com/kb/942173/en-us (Error message when you try to move or resize a window on a computer that has Windows Internet Explorer 7 installed: "An error has occurred in the script on this page")
这个在IE6和IE8中也有可能发生,也就是说当js中的代码正好执行到window.moveTo()或window.resizeTo()时,接受到鼠标按下事件,此时就会发生error。 ......