易截截图软件、单文件、免安装、纯绿色、仅160KB

C#中调用mysql存储过程出现的问题

在root账号中,可以正常调用存储过程.
换到common_user账号时,同一存储过程名调用出现问题.
追踪调试时出现:
SELECT command denied to user 'common_user'@'localhost' for table 'proc'
搜索解决方案:
MySqlConnection myconnection = new MySqlConnection("server=localhost;user id=common_user; password=***;database=testdb; Use Procedure Bodies=false;Charset=utf8;");

关键语句是:
Use Procedure Bodies=false;
在网上搜索本句含义:
Name : Use Procedure Bodies 
Default : true 
Description : Setting this option to false indicates that the user connecting to the database does not have the SELECT privileges for the mysql.proc (stored procedures) table. When to set to false, Connector/NET will not rely on this information being available when the procedure is called. Because Connector/NET will be unable to determine this information, you should explicitly set the types of the all the parameters before the call and the parameters should be added to the command in the exact same order as they appear in the procedure definition. This option was added in Connector/NET 5.0.4 and Connector/NET 1.0.10. 
 大体意思是说:
当设置时use procedure bodies=false,存储过程的参数需要与程序里的参数顺序一致.
还未结束.
在mysql官方.给出了这样设置会有一个BUG.
http://bugs.mysql.com/bug.php?id=36694
当然这样解决的办法还是有的.可以使用ODBC连接来实现.
这里不再详细说明.
附上.NET连接mysql的连接字符串网址(比较全面的连接归类):
http://www.connectionstrings.com/mysql


相关文档:

JavaScript中访问C#变量及方法

1.如何在javascript访问C#变量
方法一:使用<%=%>
 <input id="Button3" type="button" value="js调用c#变量" onclick="return Button3_onclick()" />
function Button3_onclick()
{        
    alert('我的名字:'+ '<%=name %>'); ......

c# 读写XML文件

   用c#给PDA做了一个PC端的通讯程序,需要保存两个参数。用Delphi时,是保存在ini文件中,c#读写XML比较方便,就用xml文件来保存了。
   
 
class CXmlClass
{
private string XmlFilePath;
/// <summary>
/// 下载到PDA的TXT文件路径 
/// </summary>
......

c#启动Sql Server服务

程序启动Sql Server其实很简单
代码:
System.ServiceProcess.ServiceController   myController   =
new   System.ServiceProcess.ServiceController("MSSQL$ACCP4444"); //服务名称 找了半天才找到,笨死我完了。在服务上右键属性,能看到
if (myController.CanStop)
{ }
else ......

java与c#通信数据转换问题

/由于JAVA语言的数据类型都是有符号类型,而C# C++一般数据类型都是分有符号和无符号,
//因此在通信过程中传递的Byte[]无法直
接转换成C#需要的类型,
//以前倒是没注意这些细节,因为一般用一种语言编程,
//大都有内置的转换方法。跨语言环境的转换就的自己动
手想办法了。
1、java的Byte[]转换成c#的Int32
privat ......

JAVA与C#比较

C#与JAVA的相同之处:由于C#与JAVA都是基于C++发展起来的,因此二者之间具有很多相似之处,具体如下:
  1、C#和JAVA语言的编译结果是独立于计算机和编程语言的,可执行文件可以在受管理的执行
  环境中执行;
  2、C#和JAVA语言都是采用了自动的垃圾回收机制;
  3、C#和JAVA语言都取消了指针操作;
  4、 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号