On Wed, Feb 10, 2016 at 7:20 AM, Paul Newton <[email protected]> wrote:
> Hi all > > In VFP we can do this > > lnConnection = SQLSTRINGCONNECT(cConnectString) > SQLEXEC(lnConnection,"Select * From cname") && puts results into > SQLRESULT > > I am wondering what is the nearest equivalent in .NET This is what I have > come up with, but is there a better way? > > SqlConnection sqlConnection1 = new SqlConnection(cConnectString); > SqlCommand cmd = new SqlCommand(); > SqlDataReader reader; > cmd.CommandText = "SELECT * FROM cname"; > cmd.CommandType = CommandType.Text; > cmd.Connection = sqlConnection1; > sqlConnection1.Open(); > reader = cmd.ExecuteReader(); > > Also how would I approach UPDATE and DELETE etc? > ---------------- In .NET I would do Entity Framework. Below is how to stick EF into MVC and easily combine the two. If you are just starting with .NET this is one of the prefered ways of doing things today. http://www.asp.net/mvc/overview/getting-started/getting-started-with-ef-using-mvc/creating-an-entity-framework-data-model-for-an-asp-net-mvc-application Just EF here http://www.entityframeworktutorial.net/ -- Stephen Russell Sr. Analyst Ring Container Technology Oakland TN 901.246-0159 cell --- StripMime Report -- processed MIME parts --- multipart/alternative text/plain (text body -- kept) text/html --- _______________________________________________ Post Messages to: [email protected] Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech Searchable Archive: http://leafe.com/archives/search/profox This message: http://leafe.com/archives/byMID/profox/CAJidMY+Jjo2G7QO57=NCSQS-eW=xyh33etmg2+gbdumb35t...@mail.gmail.com ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

