|
Here is some more code: I don't know if this will help but here goes.
<%@ Page Language="VB" Debug="true" %> <%@ Register TagPrefix="Menu" TagName="Nav" Src="pubnav.ascx" %> <%@ import Namespace="System.Data" %> <%@ import Namespace="System.Data.SQLClient" %> <script runat="server">
'define the connection dim objConn as new SQLConnection ("data source=Localhost; Initial Catalog=WestOhioUMCWebData;" & _ "User id = WebData_sa; Password = BDW0CUMC;" & _ "Persist security info = true; Packet size=4096") sub Page_Load(obj as Object, e as EventArgs) if not Page.IsPostBack then Label2.Text = "Welcome, Administrator. <br>1. To edit jobs see the blue Data " & _ " Grid below and choose the edit option at the end. <br> 2. To insert a new job enter the correct information under the grid in the blanks<br>" & _ "3. To delete jobs select the proper JobID below in the drop-down box and select the button. <br>" & _ "         <b>**** The Date Posted field and Title field is required ****</b> " objConn.open() 'Declare the string dim strcom2 as string strcom2 = "Select JobID FROM Jobnet" 'sets up the command and reader to execute the command and retrieve the data dim objcommand2 AS New SQLCommand(strcom2, objConn) dim objreader as SQLDataReader objreader = objcommand2.ExecuteReader 'binds the data to the CourseId dropdownlist ddjobid.DataSource = objreader ddjobid.DataBind() ddjobid.Items.Insert(0, new ListItem("<--Select JobID-->", "")) 'closes the reader objreader.Close() BindGrid() end if end sub
Sub Delete_Job(obj as object, e as EventArgs) 'define the connection dim objConn as new SQLConnection ("data source=Localhost; Initial Catalog=WestOhioUMCWebData;" & _ "User id = WebData_sa; Password = BDW0CUMC;" & _ "Persist security info = true; Packet size=4096") Dim strcom as string strcom = "DELETE FROM JobNet Where JobId=" & ddjobid.SelectedItem.Value & " " dim objCmd as New SQLCommand(strcom, objConn) objCmd.Connection.Open() try objCmd.ExecuteNonQuery() catch ex as Exception Response.Write("error updating the Database") end try 'Declare the string dim strcom2 as string strcom2 = "Select JobID FROM Jobnet" 'sets up the command and reader to execute the command and retrieve the data dim objcommand2 AS New SQLCommand(strcom2, objConn) dim objreader as SQLDataReader objreader = objcommand2.ExecuteReader 'binds the data to the CourseId dropdownlist ddjobid.DataSource = objreader ddjobid.DataBind() ddjobid.Items.Insert(0, new ListItem("<--Select JobID-->", "")) 'closes the reader objreader.Close() BindGrid() end sub
</script>
HTML
<body> <table align="left" border="0"> <tbody
|