帮把C#代码段转成VB的,谢谢

namespaceWen{///<summary>///c_QuestionPaper_add的摘要说明。///</summary>publicpartialclassc... namespace Wen
{
/// <summary>
/// c_QuestionPaper_add 的摘要说明。
/// </summary>
public partial class c_QuestionPaper_add : System.Web.UI.Page
{

protected void Page_Load(object sender, System.EventArgs e)
{
if(!Page.IsPostBack)
{
BindWnameDate();
}

}

//挷定问卷名
private void BindWnameDate()
{
this.Wname.Items.Clear();

SqlConnection con=DB.createConnection();
con.Open();

SqlCommand cmd=new SqlCommand("select W#,Wname from wenjuan",con);

SqlDataReader sdr=cmd.ExecuteReader();
this.Wname.DataSource=sdr;
this.Wname.DataTextField="Wname";
this.Wname.DataValueField="W#";
this.Wname.DataBind();
sdr.Close();

con.Close();
}

//挷定问卷题目
private void BindTleirongDate(int Wno)
{
this.Tleirong.Items.Clear();

SqlConnection con1=DB.createConnection();
con1.Open();

SqlCommand cmd1=new SqlCommand("select T#,Tleirong from wenjti where W#="+Wno,con1);

SqlDataReader sdr1=cmd1.ExecuteReader();
this.Tleirong.DataSource=sdr1;
this.Tleirong.DataTextField="Tleirong";
this.Tleirong.DataValueField="T#";
this.Tleirong.DataBind();
sdr1.Close();

con1.Close();
}

#region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}

/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{

}
#endregion

//添加问卷名
protected void ok1_Click(object sender, System.EventArgs e)
{
string newWname=this.newWname.Text.Trim().ToString();

if(newWname=="")
{
Response.Write("<script>alert('请填写问卷名,再执行此操作!!')</script>");
}
else
{
SqlConnection con2=DB.createConnection();
con2.Open();

SqlCommand cmd2=new SqlCommand("select top 1 W# from wenjuan order by W# desc",con2);
int y=Convert.ToInt32(cmd2.ExecuteScalar());
int y1=y+1;

SqlCommand scmd=new SqlCommand();
scmd.Connection=con2;
scmd.CommandText="insert into wenjuan values('"+y1+"','"+newWname+"','0','','')";
scmd.ExecuteNonQuery();

con2.Close();

BindWnameDate();

Response.Write("<script>alert('已添加成功!!')</script>");

this.newWname.Text="";
}

}
展开
 我来答
定复2d
2009-04-04 · TA获得超过3196个赞
知道大有可为答主
回答量:2052
采纳率:0%
帮助的人:1916万
展开全部
Namespace Wen
End Namespace 'Wen
_
'/ <summary>
'/ c_QuestionPaper_add 的摘要说明。
'/ </summary>
Class c_QuestionPaper_add
Inherits System.Web.UI.Page

Protected Sub Page_Load(sender As Object, e As System.EventArgs)
If Not Page.IsPostBack Then
BindWnameDate()
End If
End Sub 'Page_Load

'挷定问卷名
Private Sub BindWnameDate()
Me.Wname.Items.Clear()

Dim con As SqlConnection = DB.createConnection()
con.Open()

Dim cmd As New SqlCommand("select W#,Wname from wenjuan", con)

Dim sdr As SqlDataReader = cmd.ExecuteReader()
Me.Wname.DataSource = sdr
Me.Wname.DataTextField = "Wname"
Me.Wname.DataValueField = "W#"
Me.Wname.DataBind()
sdr.Close()

con.Close()
End Sub 'BindWnameDate

'挷定问卷题目
Private Sub BindTleirongDate(Wno As Integer)
Me.Tleirong.Items.Clear()

Dim con1 As SqlConnection = DB.createConnection()
con1.Open()

Dim cmd1 As New SqlCommand("select T#,Tleirong from wenjti where W#=" + Wno, con1)

Dim sdr1 As SqlDataReader = cmd1.ExecuteReader()
Me.Tleirong.DataSource = sdr1
Me.Tleirong.DataTextField = "Tleirong"
Me.Tleirong.DataValueField = "T#"
Me.Tleirong.DataBind()
sdr1.Close()

con1.Close()
End Sub 'BindTleirongDate

'
'ToDo: Error processing original source shown below
'
'
'---^--- Pre-processor directives not translated
Protected Sub OnInit(e As EventArgs)
'
'ToDo: Error processing original source shown below
'
'
'--^--- Unexpected pre-processor directive
'
' CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
'
InitializeComponent()
MyBase.OnInit(e)
End Sub 'OnInit

'/ <summary>
'/ 设计器支持所需的方法 - 不要使用代码编辑器修改
'/ 此方法的内容。
'/ </summary>
Private Sub InitializeComponent()
End Sub 'InitializeComponent

'
'ToDo: Error processing original source shown below
'
'
'---^--- Pre-processor directives not translated
'
'ToDo: Error processing original source shown below
'
'
'--^--- Unexpected pre-processor directive
'
'ToDo: Error processing original source shown below
'
'
'--------^--- 'class', 'struct', 'interface' or 'delegate' expected
'
'ToDo: Error processing original source shown below
'
'
'----------------^--- Syntax error: ';' expected
'
'ToDo: Error processing original source shown below
'System.Char[]
'^--- Syntax error: '}' expected
'添加问卷名
Protected Sub ok1_Click(sender As Object, e As System.EventArgs)
Dim newWname As String = Me.newWname.Text.Trim().ToString()

If newWname = "" Then
Response.Write("<script>alert('请填写问卷名,再执行此操作!!')</script>")
Else
Dim con2 As SqlConnection = DB.createConnection()
con2.Open()

Dim cmd2 As New SqlCommand("select top 1 W# from wenjuan order by W# desc", con2)
Dim y As Integer = Convert.ToInt32(cmd2.ExecuteScalar())
Dim y1 As Integer = y + 1

Dim scmd As New SqlCommand()
scmd.Connection = con2
scmd.CommandText = "insert into wenjuan values('" + y1 + "','" + newWname + "','0','','')"
scmd.ExecuteNonQuery()

con2.Close()

BindWnameDate()

Response.Write("<script>alert('已添加成功!!')</script>")

Me.newWname.Text = ""
End If
End Sub 'ok1_Click
End Class 'c_QuestionPaper_add

你自己测试下吧···我也不知道对吗
疯月龙族灬绝恋
2009-04-05 · TA获得超过124个赞
知道答主
回答量:93
采纳率:0%
帮助的人:49.8万
展开全部
请问楼主是不是用 Microsoft Visual Studio 2005 写的!

好像它有提供语言转换的选项,你可以试试看,我说的不一定准确!
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
pj96127
2009-04-06 · TA获得超过477个赞
知道小有建树答主
回答量:703
采纳率:0%
帮助的人:562万
展开全部
以后这种问题,你可以下载一个软件SharpDevelop 里面可以把C#转换为VB的代码.
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 更多回答(1)
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式