[WebMethod] public stu viks( int id) { string str = System.Configuration.ConfigurationManager.ConnectionStrings["cccvConnectionString"].ConnectionString; SqlConnection con = new SqlConnection(str); SqlCommand cmd = new SqlCommand("getstudents", con); cmd.CommandType = CommandType.StoredProcedure; SqlParameter ccv = new SqlParameter("@id", id); cmd.Parameters.Add(ccv); stu cc = new stu(); con.Open(); SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { cc.id = Convert.ToInt32(reader["id"]); cc.name = reader["name"].ToString(); cc.gender = reader["gender"].ToString(); cc.totalmarks = Convert.ToInt32(reader["totalmarks"]); con.Close(); } return cc;
create proc getstudents22 @id int as BEGIN select name, gender , totalmarks from students11 where id = @id END
id int primary key, name varchar(20), gender varchar(20), totalmarks int
select name, gender , totalmarks from students11 where id = @id
cc.id = Convert.ToInt32(reader["id"]);
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)