问题描述
代码都写了,没有提示代码错误,却实现不了功能。下面是我写的代码和要求谁能在11号前帮我解决我把所有分都送给他1、用户注册客户端程序采用B/S结构,程序要求:l客户端程序是一个login.htm的注册网页,包含名称为user的用户文本框与名称是pass的密码框,在输入用户名光标离开user框时,即刻可以显示该用户名称是否可以使用。并且在用户名称与密码都不为空时才可以提交。l服务器端实现用户的注册,把新用户写入数据库,并实现用户名称是否可以使用的查询。<html><head><title></title></head><body><scriptlanguage="JavaScript">functioncheck(){varu=frm.user.value;//if(u=="")frm.user.focus();else{//提交u给服务器http://localhost/ajax/default.aspxvarhttp=newActiveXObject("Microsoft.XMLHTTP");varurl="http://localhost/ajax/default.aspx?user="+u;http.open("get",url,false);http.send(null);vars=http.responseText;if(s!=""){alert(s);frm.user.focus();}}}</script><center><formname="frm"><h1>用户注册</h1>名称<inputtype="text"name="user"onblur="check()"><br>密码<inputtype="password"name="pass"><br><inputtype="submit"value="注册"></form></center></body></html>服务器端程序usingSystem;usingSystem.Configuration;usingSystem.Data;usingSystem.Linq;usingSystem.Web;usingSystem.Web.Security;usingSystem.Web.UI;usingSystem.Web.UI.HtmlControls;usingSystem.Web.UI.WebControls;usingSystem.Web.UI.WebControls.WebParts;usingSystem.Xml.Linq;publicpartialclass_Default:System.Web.UI.Page{protectedvoidPage_Load(objectsender,EventArgse){String[]st=newString[]{"张三","李四","王五","Bob","Tom","Smith","Marry","Jerry"};//从网页中获取输入姓名Stringuser=Request.QueryString["user"];if(user!=null&&user!=""){for(inti=0;i<st.Length;i++){if(String.Compare(st[i],user,true)==0){Response.Write(user+"已经被别人使用!");return;}}}}}2、远程图像管理程序要求:l服务器端采用asp.net设计服务程序,实现对该程序目录下的图像进行管理l客户端采用Windows程序,并采用HTTP协议与服务器建立通讯,连接服务器后能显示出所有的图像,并能实现图像的下载与上传。ClientusingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Linq;usingSystem.Text;usingSystem.Windows.Forms;usingSystem.IO;namespaceImageClient{publicpartialclassForm1:Form{MSXML2.XMLHTTPhttp;publicForm1(){InitializeComponent();}privatevoidForm1_Load(objectsender,EventArgse){http=newMSXML2.XMLHTTP();textBox1.Text="http://localhost/ImageServer.aspx";}privatevoidbutton4_Click(objectsender,EventArgse){//connectStringurl=textBox1.Text+"?op=list";http.open("get",url,false,null,null);http.send(null);Strings=http.responseText;String[]fn=s.Split(newchar[]{'n'},StringSplitOptions.RemoveEmptyEntries);for(inti=0;i<fn.Length;i++)listBox1.Items.Add(fn[i]);button4.Enabled=false;}privatevoidbutton2_Click(objectsender,EventArgse){//downloadif(listBox1.SelectedIndex>=0){Stringfn=listBox1.Items[listBox1.SelectedIndex].ToString();Stringurl=textBox1.Text+"?op=download&fn="+fn;http.open("get",url,false,null,null);http.send(null);byte[]buf=(byte[])http.responseBody;MemoryStreamms=newMemoryStream(buf);pictureBox1.Image=Image.FromStream(ms);}}privatevoidbutton1_Click(objectsender,EventArgse){//uploadopenFileDialog1.Filter="jpg|*.jpg";if(openFileDialog1.ShowDialog()==DialogResult.OK){Stringfn=openFileDialog1.FileName;FileStreamfs=newFileStream(fn,FileMode.Open);byte[]buf=newbyte[fs.Length];fs.Read(buf,0,buf.Length);fs.Close();intp=fn.LastIndexOf("\");if(p>=0)fn.Substring(p+1);Stringurl=textBox1.Text+"?op=upload&fn="+fn;http.open("post",url,false,null,null);http.send(buf);Strings=http.responseText;if(s=="OK"){listBox1.Items.Add(fn);}}}}}ServerusingSystem;usingSystem.Collections;usingSystem.Configuration;usingSystem.Data;usingSystem.Linq;usingSystem.Web;usingSystem.Web.Security;usingSystem.Web.UI;usingSystem.Web.UI.HtmlControls;usingSystem.Web.UI.WebControls;usingSystem.Web.UI.WebControls.WebParts;usingSystem.Xml.Linq;usingSystem.IO;publicpartialclassImageServer:System.Web.UI.Page{protectedvoidPage_Load(objectsender,EventArgse){Stringop=Request.QueryString["op"];if(op==null)op="";Stringdir=Server.MapPath("");if(!dir.EndsWith("\"))dir=dir+"\";if(op=="list"){String[]fn=Directory.GetFiles(dir,"*.jpg");Strings="";for(inti=0;i<fn.Length;i++){s=s+fn[i].Substring(dir.Length)+"n";}Response.Write(s);}elseif(op=="download"){Stringfn=Request.QueryString["fn"];if(File.Exists(dir+fn)){Response.WriteFile(dir+fn);}}elseif(op=="upload"){Stringfn=Request.QueryString["fn"];Request.SaveAs(dir+fn,false);Response.Write("OK");}}}
解决方案
解决方案二:
3、远程数据查询程序要求:l建立Access数据库与students表格,包含学生学号(sno)、姓名(sname)、班级(sclass)字段。l服务器端采用asp.net设计服务程序,实现数据库的查询l客户端采用Windows程序,并采用HTTP协议与服务器建立通讯,实现对学生数据库按学号、姓名、班级进行查询。ClientusingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Linq;usingSystem.Text;usingSystem.Windows.Forms;usingSystem.IO;namespacestudentClient{publicpartialclassForm1:Form{MSXML2.XMLHTTPhttp;publicForm1(){InitializeComponent();}privatevoidForm1_Load(objectsender,EventArgse){comboBox1.Items.Add("学号");comboBox1.Items.Add("姓名");comboBox1.Items.Add("班级");comboBox1.SelectedIndex=0;comboBox2.Items.Add("相等于");comboBox2.Items.Add("类似于");comboBox2.SelectedIndex=0;http=newMSXML2.XMLHTTP();}privatevoidbutton1_Click(objectsender,EventArgse){Stringsql="select*fromstudentsorderbysno";if(textBox1.Text!=""){sql="select*fromstudentswhere";if(comboBox1.Text=="学号")sql=sql+"sno";elseif(comboBox1.Text=="姓名")sql=sql+"sname";elseif(comboBox1.Text=="班级")sql=sql+"sclass";if(comboBox2.Text=="相等于")sql=sql+"=";elsesql=sql+"like";sql=sql+"'"+textBox1.Text+"'";}http.open("get",textBox2.Text+"?sql="+sql,false,null,null);http.send(null);byte[]buf=(byte[])http.responseBody;MemoryStreamms=newMemoryStream(buf);DataTabledt=newDataTable();dt.ReadXml(ms);dataGridView1.DataSource=dt;}}}ServerusingSystem;usingSystem.Collections;usingSystem.Configuration;usingSystem.Data;usingSystem.Linq;usingSystem.Web;usingSystem.Web.Security;usingSystem.Web.UI;usingSystem.Web.UI.HtmlControls;usingSystem.Web.UI.WebControls;usingSystem.Web.UI.WebControls.WebParts;usingSystem.Xml.Linq;usingSystem.IO;usingSystem.Data.OleDb;publicpartialclassstudentserver:System.Web.UI.Page{protectedvoidPage_Load(objectsender,EventArgse){try{Stringsql=Request.QueryString["sql"];if(sql==null||sql=="")return;//Stringsql="select*fromstudents";OleDbConnectioncon=newOleDbConnection();Strings=Server.MapPath("");if(!s.EndsWith("\"))s=s+"\";con.ConnectionString="Provider=Microsoft.Jet.OLEDB.4.0;DataSource="+s+"students.mdb";con.Open();OleDbDataAdapterada=newOleDbDataAdapter(sql,con);DataTabledt=newDataTable("DT");ada.Fill(dt);MemoryStreamms=newMemoryStream();dt.WriteXml(ms,XmlWriteMode.WriteSchema);byte[]buf=ms.ToArray();Response.BinaryWrite(buf);con.Close();}catch(Exceptionexp){Response.Write(exp.Message);}}}
解决方案三:
完成后请发送到我的邮箱809899396@163.com谢谢各位
解决方案四:
楼主你这是干嘛啊???谁的事件都很宝贵…………知道不?