vb.net中第1行的编译错误 [英] Compilation error in line no 1 in vb.net

查看:77
本文介绍了vb.net中第1行的编译错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的朋友,我收到第1行编译错误,请进行更正,

谢谢.

Dear friends I am getting compilation error line no 1, please make the correction,

Thank you.

Imports System.Collections.Generic
Imports System.Linq
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Data.SqlClient
Imports System.Configuration

Public Partial Class Registration
	Inherits System.Web.UI.Page
	Protected Sub Page_Load(sender As Object, e As EventArgs)

	End Sub
	Protected Sub Button1_Click(sender As Object, e As EventArgs)
		Dim conn As New SqlConnection("Data Source=.\\SQLEXPRESS;AttachDbFilename="|DataDirectory|Copy of Regstr.mdf";Integrated Security=True;User Instance=True")
		conn.Open()

		Dim cmd As New SqlCommand((((((((("insert into Register values ('" + DropDownListdept.Text & "','") + txtempname.Text & "','") + DropDownListDesign.Text & "','") + DropDownListdays.Text & "','") + txtfrm.Text & "','") + txtto.Text & "','") + DropDownListleave.Text & "','") + txtresonforleav.Text & "','") + txtincharge.Text & "')", conn)


		cmd.ExecuteNonQuery()
		conn.Close()

		Label1.Text = "Your Data Stored Successfully"
	End Sub
End Class

推荐答案

问题出在这一行:

The problem is in this line:

Dim conn As New SqlConnection("Data Source=.\\SQLEXPRESS;AttachDbFilename="|DataDirectory|Copy of Regstr.mdf";Integrated Security=True;User Instance=True")



将其更改为:



Change that into this:

Dim conn As New SqlConnection("Data Source=.\\SQLEXPRESS;AttachDbFilename=""|DataDirectory|Copy of Regstr.mdf"";Integrated Security=True;User Instance=True")



希望这会有所帮助.



Hope this helps.


这篇关于vb.net中第1行的编译错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆