请问谁用过VB.Net To C# Converter,我怎么总是转不成功啊?
把,VB.net写的webform程序转了,编译不通过,后来自己又手工改的终于通过编译了,但是页面上显示不出任何东西,有人有经验吗?
经过转换的CS文件如下
using System.Data;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System;
using System.Collections;
using System.Web;
using System.Web.UI.WebControls;
using System.Configuration;
using System.Drawing;
namespace fuyi
{
public class mssql : System.Web.UI.Page
{
public mssql()
{
ds = new DataSet();
}
System.Data.SqlClient.SqlConnection sqlcon;
//protected System.Web.UI.WebControls.DataGrid dg;
protected System.Web.UI.WebControls.DropDownList ddl;
protected System.Web.UI.WebControls.Label Luserinfo;
protected System.Web.UI.WebControls.DataGrid dg2;
DataSet ds;
private void Page_Load (System.Object sender, System.EventArgs e)
{
string ac;
HttpBrowserCapabilities bc = new HttpBrowserCapabilities();
bc = Request.Browser;
if (! IsPostBack)
{
System.Data.SqlClient.SqlDataAdapter sqla = new System.Data.SqlClient.SqlDataAdapter();
System.Data.SqlClient.SqlCommand sqlcmd = new System.Data.SqlClient.SqlCommand();
sqlcon = new System.Data.SqlClient.SqlConnection("server=;uid=sa;password=1026;database=Northwind");
sqlcmd.CommandText = "select * from customers";
sqlcmd.Connection = sqlcon;
sqlcon.Open();
sqla.SelectCommand = sqlcmd;
sqla.Fill(ds, "lftable");
dg2.DataSource = ds.Tables["lftable"].DefaultView;
dg2.DataBind();
}
ac = Request.ServerVariables["REMOTE_HOST"] + "ͳ" + bc.Platform + " " + bc.Type;
Luserinfo.Text = ac;
}
private void dg2_PageIndexChanged (object source, System.Web.UI.WebControls.DataGridPageChangedEventArgs e)
{
dg2.CurrentPageIndex = e.NewPageIndex;
dg2.DataBind();
}
private void dg2_DeleteCommand (object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
System.Data.SqlClient.SqlCommand sqldel = new System.Data.SqlClient.SqlCommand();
sqlcon = new System.Data.SqlClient.SqlConnection("server=127.0.0.1;uid=sa;password=1026;database=Northwind");
sqldel.CommandText = "delete from customers where customerid='" + e.Item.Cells[1].Text + "'";
sqldel.Connection = sqlcon;
sqldel.Connection.Open();
sqldel.ExecuteNonQuery();
sqldel.Connection.Close();
Response.Redirect("mssql.aspx");
}
private void InitializeComponent ()
{
this.Load += new System.EventHandler(this.Page_Load);
}
private void ddl_SelectedIndexChanged (object sender, System.EventArgs e)
{
System.Data.SqlClient.SqlCommand sqlorder = new System.Data.SqlClient.SqlCommand();
System.Data.SqlClient.SqlDataAdapter sqla = new System.Data.SqlClient.SqlDataAdapter();
sqlcon = new System.Data.SqlClient.SqlConnection("server=127.0.0.1;uid=sa;password=1026;database=northwind");
sqlorder.CommandText = "select * from customers order by " + ddl.SelectedValue.ToString();
sqlorder.Connection = sqlcon;
sqla.SelectCommand = sqlorder;
sqla.Fill(ds, "lftable");
dg2.DataSource = ds.Tables["lftable"].DefaultView;
dg2.DataBind();
}
private void dg2_ItemDataBound (object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{
string fid;
fid = e.Item.Cells[0].Text;
e.Item.Cells[0].Attributes.Add("onclick", "return confirm('真的要删除吗?');");
}
private void dg2_ItemCreated (object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{
e.Item.Cells[0].Style.Add("WIDTH", "10000px");
}
private void Btclose_Click (System.Object sender, System.EventArgs e)
{
Response.Write("<script language='javascript'>window.close();</script>");
}
private void dg2_SelectedIndexChanged(object sender, System.EventArgs e)
{
}
}
}
相关推荐
VB.Net to C# Converter将VB代码转换成C#代码
本资源为【VB.Net to C# Converter】软件,它可以将VB代码转换成C#代码,效果很好
VB.NET转C#代码转换工具实操指南
本文还有配套的精品资源,点击获取 简介:本文介绍了"VB.NET to C# Converter"工具的重要性和应用,该工具能够高效地将VB.NET代码自动转换为C#代码,保留变量名和注释,减少开发者的转换工作量。VB.NET和C#作为.NET平台上的两种语言,各有特点,其中C#在现代编程领域具有广泛应用。工具支持试用版和完整版,试用版可永久使用但处理代码行数有限。详细操作...
VB.Net to C# Converter 代码转换工具
一款将VB.Net编写的项目转换成C#项目的工具。支持单个文件的代码转换,也支持整个项目代码转换!很好用哦!
VB转C#代码工具:VB.Net to C# Converter
VB.Net to C Sharp Converter 是一款将vb.net代码转化为c#代码的程序。在转化过程中,保留了原有的注释和变量名。 VB.Net to C# Converter是一款代码转换软件,将用户的VB.Net项目转换为C#语言。与别的转换软件不同,变量名、注释行、inline comments都被保留下来,更可以转换一些相当困难的特性,比如ReDim声明,参数化属性,本地共享变量(local shared variables),事件处理,复杂的Case声明,API调用等等,代码转换的准确率超过99%。 VB.Net 至 C# 的转换工具,不需要重写代码,通过此程序,可以轻易协助程序员将 VB.Net 转换为 C#。
VB转C#代码工具VB.Net to C# Converter v2.24
VB转C#代码工具,还是比较方便的~~~~~~~~~~


