Skip to main content

Posts

Showing posts from May, 2010

Difference Between Eval and Bind in ASP.NET

Eval is a protected method defined on the TemplateControl class, from which the Page class is derived. Bind is a new ASP.NET 2.0 databinding keyword. It's not a method of any specific class. Eval is used for unidirectional (readonly) data binding, while Bind is for bi-directional (editable) databinding. ASP.NET supports a hierarchical data-binding model that creates bindings between server control properties and data sources. Almost any server control property can be bound against any public field or property on the containing page or on the server control's immediate naming container. Data-binding expressions use the Eval and Bind methods to bind data to controls and submit changes back to the database. The Eval method is a static (read-only) method that takes the value of a data field and returns it as a string. The Bind method supports read/write functionality with the ability to retrieve the values of data-bound controls and submit any changes made back to the database. You

Stored Procedures in SQL SERVER 2005

Step1 : Open SQL SERVER 2005 Step2 : Create an empty database Step3 : Go to tables and then create an empty table Let's consider table name as login, the table is look like Click on Tables | Programmability | Stored Procedure | Create new stored procedure Step4 :create procedure sp_insert(@sno varchar(10), @ sname varchar(10)) as begin insert into emp values(@eid,@ename,@esal) end Step5 : Now open Visual Studio create new website. Step6: In code behind file write SqlConnection con; SqlCommand comm; con = new SqlConnection("Data Source=BASHA;Initial Catalog=prasad;Integrated Security=True"); con.Open(); comm = new SqlCommand("sp_insert", con); comm.CommandType =CommandType .StoredProcedure ; comm.Parameters .AddWithValue ("@eid",TextBox1 .Text ); comm .Parameters .AddWithValue ("@ename",TextBox2 .Text ); comm .Parameters .AddWithValue ("@esal",TextBox3 .Text );