请问谁用过VB.Net To C# Converter,我怎么总是转不成功啊?
oyff 2004-11-11 02:37:13 我把用VB.net写的winform程序转了,结果.vb的文件是0字节
把,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)
{
}
}
}