Click here to Skip to main content
15,896,606 members
Please Sign up or sign in to vote.
1.60/5 (2 votes)
See more:
Hi, i want to do select, insert, update, delete from database using ADO.NET and not ADO.NET Entity for some raisons plz can anyone help me with this just some link or exemples
i'm using asp.net mvc 4 razor
Posted

http://www.c-sharpcorner.com/UploadFile/1492b1/complete-crud-operations-in-mvc-4-using-entity-framework-5-w/

Complete CRUD Operations in MVC 4 using Entity Framework 5 Without Writing a Single Line of Code[^]

CRUD Operations Using the Repository Pattern in MVC[^]


[^]

see it

it will help you
 
Share this answer
 
This below link give you a correct path to start with :

http://stackoverflow.com/questions/6694098/using-asp-net-mvc-with-classic-ado-net

[Youtube Video]

Hope you will be helpful with this link.
 
Share this answer
 
v2
If you don't want to use Entity Framework there are many other (ADO-base) options. Most of them introduce just as much overhead as EF, if that's your concern, but if you want just plain SQL access you can use the System.Data.SqlClient namespace. Use the SqlConnection and SqlCommand to manually make database calls and changes.

Of course this will result in tightly coupled code and you'll lose the default model binders. You'll need to either rebuild those or hand-jam in your controllers. Effectively you'll take the M and just be left with VC.
 
Share this answer
 
string conn = "";
conn = ConfigurationManager.ConnectionStrings["Conn"].ToString();
SqlConnection objsqlconn = new SqlConnection(conn);
objsqlconn.Open();
SqlCommand objcmd = new SqlCommand("Delete from Employee Where Employee_ID='" + _empID + "'", objsqlconn);
objcmd.ExecuteNonQuery();


string conn = "";
conn = ConfigurationManager.ConnectionStrings["Conn"].ToString();
SqlConnection objsqlconn = new SqlConnection(conn);
objsqlconn.Open();
SqlCommand objcmd = new SqlCommand("Insert into Employee(Employee_Name,Employee_Address,Employee_Salary) Values('" + txtName.Text + "','" + txtAddress.Text + "','" + txtSal.Text + "')", objsqlconn);
objcmd.ExecuteNonQuery();
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900