//读取标准列表
private void setModelList()
{
OleDbConnection Connection = null;
string tableName = "";
try
{
string strMdb = this.textBox5.Text;//mdb路径
Connection = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + strMdb + "");
Connection.Open();
......
//读取标准列表
private void setModelList()
{
OleDbConnection Connection = null;
string tableName = "";
try
{
string strMdb = this.textBox5.Text;//mdb路径
Connection = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + strMdb + "");
Connection.Open();
......
(转帖)
一提到如何在前台JS调用后台C#方法,AJAX成为了必然的想法。
只是实现的细节采用AJAX 1.0或者AjaxPro的区别。
其实如果不用AJAX,我们也能够很方便地利用JS调用后台方法。
步骤如下:
1 前台放一个按钮。设置为隐藏。注意:不能直接设置Visible=false的方式,这样的话在ASP.Net 2.0编译后的代码里是找不到这个按钮的。需要设置风格:style="display:none;"
2 双击按钮,写入C#方法,或者写一个调用后台其他方法的代码段
3 前台JS调用的时候,照如下写,这样可以模拟按钮的点击事件,触发后台方法:
document.getElementById("Button2").click();
示例
ASP.Net页:
<mce:script type="text/javascript"><!--
function go()
{
document.getElementById("Button2").click();
}
// --></mce:script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:Button ID ......
(转帖)
一提到如何在前台JS调用后台C#方法,AJAX成为了必然的想法。
只是实现的细节采用AJAX 1.0或者AjaxPro的区别。
其实如果不用AJAX,我们也能够很方便地利用JS调用后台方法。
步骤如下:
1 前台放一个按钮。设置为隐藏。注意:不能直接设置Visible=false的方式,这样的话在ASP.Net 2.0编译后的代码里是找不到这个按钮的。需要设置风格:style="display:none;"
2 双击按钮,写入C#方法,或者写一个调用后台其他方法的代码段
3 前台JS调用的时候,照如下写,这样可以模拟按钮的点击事件,触发后台方法:
document.getElementById("Button2").click();
示例
ASP.Net页:
<mce:script type="text/javascript"><!--
function go()
{
document.getElementById("Button2").click();
}
// --></mce:script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:Button ID ......
对于asp.net,默认只允许上传2M文件,增加如下配置,一般可以自定义最大文件大小.
<httpRuntime executionTimeout="300" maxRequestLength="40960" useFullyQualifiedRedirectUrl="false"/>
我们在上传大文件时都遇到过这样或那样的问题。设置很大的maxRequestLength值并不能完全解决问题,因为ASP.NET会block直到把
整个文件载入内存后,再加以处理。实际上,如果文件很大的话,我们经常会见到Internet Explorer显示 "The page
cannot be displayed - Cannot find server or DNS
Error",好像是怎么也catch不了这个错误。为什么?因为这是个client side错误,server
side端的Application_Error是处理不到的,可以参考这个帖子研究一下产生这个错误的机理。
handling server error when upload file too large
解决的方法是利用隐含的HttpWorkerRequest,用它的GetPreloadedEntityBody 和
ReadEntityBody方法从IIS为ASP.NET建立的pipe里分块读取数据,Chris
Hynes为我们提供了这样的一个方案(用HttpModule),该方案除了允许你上传大文件外,还能实时显示上传进度。
IServiceProvider provider = ......
对于asp.net,默认只允许上传2M文件,增加如下配置,一般可以自定义最大文件大小.
<httpRuntime executionTimeout="300" maxRequestLength="40960" useFullyQualifiedRedirectUrl="false"/>
我们在上传大文件时都遇到过这样或那样的问题。设置很大的maxRequestLength值并不能完全解决问题,因为ASP.NET会block直到把
整个文件载入内存后,再加以处理。实际上,如果文件很大的话,我们经常会见到Internet Explorer显示 "The page
cannot be displayed - Cannot find server or DNS
Error",好像是怎么也catch不了这个错误。为什么?因为这是个client side错误,server
side端的Application_Error是处理不到的,可以参考这个帖子研究一下产生这个错误的机理。
handling server error when upload file too large
解决的方法是利用隐含的HttpWorkerRequest,用它的GetPreloadedEntityBody 和
ReadEntityBody方法从IIS为ASP.NET建立的pipe里分块读取数据,Chris
Hynes为我们提供了这样的一个方案(用HttpModule),该方案除了允许你上传大文件外,还能实时显示上传进度。
IServiceProvider provider = ......
java中使用二维 数组
ognNf_v
public class Array2D...{
m@EvM)y0e2r
s
public static void main(String[] args)...{JAVA中文站社区门户 ~j!lSR^ z5bR5O
int myInt[][]=new int[5][10];
@XH3ao\
//遍历,给数组中的每一个数组赋值JAVA中文站社区门户R8p'd3\`lT
for(int i=0;i<myInt.length;i++)...{JAVA中文站社区门户fqHZUI#K
for(int j=0;j<myInt[0].length;j++)...{JAVA中文站社区门户q"VYu{
myInt[j]=i*j;JAVA中文站社区门户oKg2om|X2o
}
Qw`h]2Q
}JAVA中文站社区门户YoPgh
hN
System.out.println ("myInt.length="+myInt.length+",myInt[0].length="+myIn ......
java中使用二维 数组
ognNf_v
public class Array2D...{
m@EvM)y0e2r
s
public static void main(String[] args)...{JAVA中文站社区门户 ~j!lSR^ z5bR5O
int myInt[][]=new int[5][10];
@XH3ao\
//遍历,给数组中的每一个数组赋值JAVA中文站社区门户R8p'd3\`lT
for(int i=0;i<myInt.length;i++)...{JAVA中文站社区门户fqHZUI#K
for(int j=0;j<myInt[0].length;j++)...{JAVA中文站社区门户q"VYu{
myInt[j]=i*j;JAVA中文站社区门户oKg2om|X2o
}
Qw`h]2Q
}JAVA中文站社区门户YoPgh
hN
System.out.println ("myInt.length="+myInt.length+",myInt[0].length="+myIn ......
——————————————————————————————————
在c#中如何使用以前c++的.lib库和.h头文件
zhujiang_1977(朱江)
我曾经遇到过类似的问题,我的解决方法是,用VC将“以前c++的.lib库和.h头文件”编译成COM,再在C#中使用,结果是功能上大体都可以实现,但是速度上稍微有些慢。
fa2002(风翔万里)
我写过2个VC的接口连接程序,没COM什么事,我建议你到MSDN中寻找"封送处理" 看看MS的建议方法再说。
zeaing()
你的问题是个很大的问题,牵涉到代码的重用、COM DLL的重用、Win32 API DLL的重用,等等。只能给你一些建议:
1)代码级重用是做不到的。C++的代码不能直接用在C#中。
2)你提到了很多现有的类库,例如OpenGL、DirectX等等。这些类库,都是以DLL形式出现的,要么是Win32 API DLL,要么是COM DLL。无论是哪一种,都可以在C#里面通过Interoperation重用。 ......
——————————————————————————————————
在c#中如何使用以前c++的.lib库和.h头文件
zhujiang_1977(朱江)
我曾经遇到过类似的问题,我的解决方法是,用VC将“以前c++的.lib库和.h头文件”编译成COM,再在C#中使用,结果是功能上大体都可以实现,但是速度上稍微有些慢。
fa2002(风翔万里)
我写过2个VC的接口连接程序,没COM什么事,我建议你到MSDN中寻找"封送处理" 看看MS的建议方法再说。
zeaing()
你的问题是个很大的问题,牵涉到代码的重用、COM DLL的重用、Win32 API DLL的重用,等等。只能给你一些建议:
1)代码级重用是做不到的。C++的代码不能直接用在C#中。
2)你提到了很多现有的类库,例如OpenGL、DirectX等等。这些类库,都是以DLL形式出现的,要么是Win32 API DLL,要么是COM DLL。无论是哪一种,都可以在C#里面通过Interoperation重用。 ......
[C#]
public void RunSqlTransaction(string myConnString)
{
SqlConnection myConnection = new SqlConnection(myConnString);
myConnection.Open();
SqlCommand myCommand = myConnection.CreateCommand();
SqlTransaction myTrans;
// Start a local transaction
myTrans = myConnection.BeginTransaction();
// Must assign both transaction object and connection
// to Command object for a pending local transaction
myCommand.Connection = myConnection;
myCommand.Transaction = myTrans;
try
{
myCommand.CommandText = "Insert into Region (RegionID, RegionDescription) VALUES (100, ´Description´)";
myCommand.ExecuteNonQuery();
myCommand.CommandText = "Insert into ......
[C#]
public void RunSqlTransaction(string myConnString)
{
SqlConnection myConnection = new SqlConnection(myConnString);
myConnection.Open();
SqlCommand myCommand = myConnection.CreateCommand();
SqlTransaction myTrans;
// Start a local transaction
myTrans = myConnection.BeginTransaction();
// Must assign both transaction object and connection
// to Command object for a pending local transaction
myCommand.Connection = myConnection;
myCommand.Transaction = myTrans;
try
{
myCommand.CommandText = "Insert into Region (RegionID, RegionDescription) VALUES (100, ´Description´)";
myCommand.ExecuteNonQuery();
myCommand.CommandText = "Insert into ......