📄 issue_declaration.aspx.vb
字号:
Imports System.Data
Imports System.Data.SqlClient
Partial Class WebForm22
Inherits System.Web.UI.Page
#Region " Web 窗体设计器生成的代码 "
'该调用是 Web 窗体设计器所必需的。
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
'注意: 以下占位符声明是 Web 窗体设计器所必需的。
'不要删除或移动它。
Private designerPlaceholderDeclaration As System.Object
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: 此方法调用是 Web 窗体设计器所必需的
'不要使用代码编辑器修改它。
InitializeComponent()
End Sub
#End Region
Private connectionstring As String
Dim mycmd As SqlCommand
Dim sql, uid As String
Dim conn As SqlConnection
Dim ds As DataSet = New DataSet
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'在此处放置初始化页的用户代码
conn = New SqlConnection(connectionstring)
conn.ConnectionString = "server=HP-PC;Database=SRM;uid=sa;pwd=sa;"
conn.Open()
If Not IsPostBack Then
If Session("user_id") = "" Then
Response.Redirect("login.aspx")
Else
uid = Session("user_id")
Dim dbcommand As SqlDataAdapter
sql = "select group_id from sci_group where dep_id in (select sci_group.dep_id from sci_user,sci_group where sci_user.group_id=sci_group.group_id and sci_user.user_id= '" + uid + " ')"
dbcommand = New SqlDataAdapter(sql, conn)
dbcommand.Fill(ds)
DropDownList1.DataSource = ds.Tables(0)
DropDownList1.DataTextField = ds.Tables(0).Columns(0).ColumnName
DropDownList1.DataValueField = ds.Tables(0).Columns(0).ColumnName
DropDownList1.DataBind()
DropDownList1.Items.Insert(0, New ListItem("请选择", "0"))
End If
End If
sql = "select * from sci_issue where s_id='" + s_id.Value + "'"
Dim da As SqlDataAdapter = New SqlDataAdapter(sql, conn)
da.Fill(ds)
End Sub
Private Sub Submit1_ServerClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Submit1.ServerClick
If s_id.Value = "" Then
Response.Write("<script>alert('请输入课题编号! ');</script>")
ElseIf (s_name.Value = "" Or s_research_area.Value = "" Or s_keyword.Value = "" Or s_approve_unit.Value = "" Or s_approve_date.Value = "" Or s_plan_comp.Value = "" Or DropDownList1.SelectedValue = 0 Or s_abstract.Value = "") Then
Response.Write("<script>alert('输入信息不完整! ');</script>")
ElseIf (ds.Tables(0).Rows.Count <> 0) Then
Response.Write("<script>alert('该用户已存在!');</script>")
Else
sql = "insert into sci_issue(s_id,s_name,s_research_area,s_keyword,s_type,fruit_type,s_research_form,s_money_src,s_approve_unit,s_approve_date,s_plan_comp,group_id,s_abstract,s_memo)values('" + s_id.Value + "', '" + s_name.Value + "', '" + s_research_area.Value + "', '" + s_keyword.Value + "', '" + s_type.Value + "', '" + fruit_type.Value + "', '" + s_research_form.Value + "', '" + s_money_src.Value + "', '" + s_approve_unit.Value + "', '" + s_approve_date.Value + "', '" + s_plan_comp.Value + "','" + DropDownList1.SelectedValue + "', '" + s_abstract.Value + "', '" + s_memo.Value + "') "
mycmd = New SqlCommand(sql, conn)
mycmd.ExecuteNonQuery()
mycmd.Dispose()
conn.Close()
Response.Write("<script>alert('添加成功!!!');</script>")
s_id.Value = ""
s_name.Value = ""
s_research_area.Value = ""
s_keyword.Value = ""
s_approve_unit.Value = ""
s_approve_date.Value = ""
s_plan_comp.Value = ""
DropDownList1.SelectedValue = 0
s_abstract.Value = ""
s_memo.Value = ""
End If
End Sub
Private Sub reset_ServerClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles reset.ServerClick
s_id.Value = ""
s_name.Value = ""
s_research_area.Value = ""
s_keyword.Value = ""
s_approve_unit.Value = ""
s_approve_date.Value = ""
s_plan_comp.Value = ""
DropDownList1.SelectedValue = 0
s_abstract.Value = ""
s_memo.Value = ""
End Sub
'检测成果编号是否已经存在
Private Sub Submit2_ServerClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Submit2.ServerClick
If (ds.Tables(0).Rows.Count <> 0) Then
Response.Write("<script>alert('该课题编号已存在!');</script>")
Else
Response.Write("<script>alert('不存在该课题编号,请继续添加!');</script>")
End If
End Sub
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -