c# 写 webservice接口
来源:互联网 发布:炎黄网络怎么连接 编辑:程序博客网 时间:2024/06/05 00:24
//返回值为一组数据[WebMethod]public Boolean ValiLogin(string username, string password){ SqlConnection sqlconnection = new SqlConnection(ConnectionString); sqlconnection.Open(); string cmdstring = "select password from [user] where username= " + "'" + username"'"; //sql语句 SqlCommand cmd= new SqlComnand(cmdString, sqlconnection); string pass = (string)cmd.ExecuteScalar(); //定义变量存储数据 sqlconnection.Close(); if( (pass.Trim() != password.Trim()) || pass.Trim() == null) // Trim去多余空格 return false; else return true;}//返回值为多组数据[WebMethod]protected DataSet tip_details(string username){ SqlConnection sqlconnection = new SqlConnection(ConnectionString); sqlconnection.Open(); string cmdstring = "select title,details,id,time from [tip] "; SqlDataAdapter sqlAdapteruser = new SqlDataAdapter(cmdstring, sqlconnection); DataSet ds = new DataSet(); sqlAdapteruser.Fill(ds, "tip"); sqlconnection.Close(); return ds;}[WebMethod]public DataSet send_tips(string username) //环保小贴士{ DataSet ds = new DataSet(); ds = tip_details(username); return ds;}//计数:string cmdcount = "select count(username) from [user] where username=" + "'" + username + "'"; SqlCommand cmdd = new SqlCommand(cmdcount, sqlconnection); int cc = (int)cmdd.ExecuteScalar();//查找 string cmdString = "select password from [user] where username=" + "'" + username + "'"; SqlCommand cmd = new SqlCommand(cmdString, sqlconnection); string pas = (string)cmd.ExecuteScalar();//插入string insertString = "INSERT INTO [user] (username,password,sex,age,home,destination, telephone) values(" + "'" + username + "','" + password + "','" + sex + "','" + age + "','" + home + "','" + destination + "','" + telephone + "')"; SqlCommand insert_cmd = new SqlCommand(insertString, sqlconnection); insert_cmd.ExecuteNonQuery();//更新string updateString = "UPDATE [user] SET username=" + "'" + username + "',password=" + "'" + password + "',sex=" + "'" + sex + "',age=" + "'" + age + "',home=" + "'" + home + "',destination=" + "'" + destination + "',telephone=" + "'" + telephone + "'where username=" + "'" + username + "'"; SqlCommand update_cmd = new SqlCommand(updateString, sqlconnection); update_cmd.ExecuteNonQuery();//删除 string cmdString = "delete from [order] where username=" + "'" + username + "'"; SqlCommand cmd = new SqlCommand(cmdString, sqlconnection); cmd.ExecuteNonQuery();
- c# 写 webservice接口
- WebService 写对外接口
- php写webservice接口
- WebService-写简单接口
- 如何写一个webservice接口
- java调用C# WebService接口
- C#写Webservice并发布
- C#写webservice服务引用
- C#开发XML WebService接口(SOAP)
- c# .net 调用php 的webservice接口
- C#提高webService接口调用的性能
- C# WebService (一)開發接口&調用
- C#中如何调用Webservice接口
- Android App调用C# WebService接口
- C#开发XML WebService接口(SOAP)
- C++、C#写的WebService相互调用
- 关于delphi调用c#写的webservice
- java调用c#写的webservice
- Python字符串操作
- 不懂技术的人不要对懂技术的人说这很容易实现
- 基础(使得IIS支持TCP协议)
- 估算项目的时间进度
- C++ 在模版类里面使用STL 报错?
- c# 写 webservice接口
- JAVA分为三个体系,JavaSE,JavaEE,JavaME(J2ME)的区别以及各个版
- 用makefile编译C文件
- ios 文件操作实例
- XeTeX + xeCJK 重间符号输入 暂时办法
- c 结构与成员属性结构 结构与函数 指向结构的指针
- jbpm4.4 java节点
- C++命名规则
- 小心搅局者华为!防“狼”战行动