c# - ASP.NET: Buttons not working after inserting 'namespace' -
using system; using system.collections.generic; using system.linq; using system.web; using system.web.ui; using system.web.ui.webcontrols; using system.data.sqlclient; using system.configuration; using system.data; namespace localhost_54355 { public partial class ui : system.web.ui.page { protected void page_load(object sender, eventargs e) { sqlconnection con = new sqlconnection("server=pc\\sqlexpress;data source=dbo\\employeedatabase;integrated security=true;"); sqlcommand cmd = new sqlcommand("insert tableemployees(username,email,password,job,firstname,lastname,location,phone) values (sdfsd,sdfsdfds, 123456, xcvxcv, xcvxcvcxvx, dfgdfgd, cvbcbcbcb, 123645);", con); cmd.commandtype = commandtype.text; try { con.open(); cmd.executenonquery(); } catch (exception ex) { response.write("error: " + ex.tostring()); } { con.close(); } } protected void button1_click(object sender, eventargs e) { dbroutines.insert.addcompany(textusername.text, txtco_jobposition.text, txtco_jobpositiondescription.text, txtco_email.text, int.parse(txtco_phone.text), txtco_address.text); } protected void button3_click(object sender, eventargs e) { } protected void imagebutton1_click(object sender, imageclickeventargs e) { panel1.enabled = true; panel1.visible = true; panel3.enabled = false; panel3.visible = false; } protected void imagebutton2_click(object sender, imageclickeventargs e) { panel1.enabled = false; panel1.visible = false; panel3.enabled = true; panel3.visible = true; } protected void dropdownlistjobs_selectedindexchanged(object sender, eventargs e) { } } } dbroutines class: using system; using system.collections.generic; using system.linq; using system.text; using system.threading.tasks; using mysql.data.mysqlclient; using system.data; namespace localhost_54355 { static class dbroutines { public static class insert { public static void addcompany(string employee_username, string employee_email, string employee_password, string employee_job, string employee_firstname, string employee_lastname, string employee_location, int employee_phone, string employee_cv, string employee_availability ) { mysqlconnection con = new mysqlconnection("database=jobfind;data source=localhost;user id=root;password=1234"); mysqlcommand com = new mysqlcommand("addcompany", con); com.commandtype = commandtype.storedprocedure; com.parameters.addwithvalue("ausername", employee_username); com.parameters.addwithvalue("aemployee_email", employee_email); com.parameters.addwithvalue("aemployee_password", employee_password); com.parameters.addwithvalue("aemployee_job", employee_job); com.parameters.addwithvalue("aemployee_firstname", employee_firstname); com.parameters.addwithvalue("aemployee_lastname", employee_lastname); com.parameters.addwithvalue("aemployee_location", employee_location); com.parameters.addwithvalue("aemployee_phone", employee_phone); com.parameters.addwithvalue("aemployee_cv", employee_cv); com.parameters.addwithvalue("aemployee_availability", employee_availability); try { con.open(); com.executenonquery(); } catch (exception ex) { } { con.close(); } } } }
hey i'm having problem implementing registration page using mysql database. when insert ' namespace localhost_54355 ' in page's code, buttons, text boxes, panels, not recognized. when remove 'namespace', buttons becoming available class dbroutines not recognized. can me identify problem?
thanks!
note: variables here ' dbroutines.insert.addcompany(textusername.text, txtco_jobposition.text, txtco_jobpositiondescription.text, txtco_email.text, int.parse(txtco_phone.text), txtco_address.text); ' not correct. correct 1 'textusername.text' it's still recognized when remove 'namespace'.
<%@ page language="c#" autoeventwireup="true" codebehind="registercustomer.aspx.cs" masterpagefile="~/site.master" inherits="hi_imthegreatnamespacehere!" %>
property name inherits .. add page tag
Comments
Post a Comment