I'll look into them - thanks Dave
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Dave Crozier Sent: 10 February 2016 13:24 To: profoxtech@leafe.com Subject: RE: .NET equivalent of VFP SQL Pass-Through (i.e. without using EF or LINQ)
PAUL, Why not use datasets/tableadapters? They have all the CRUD logic built into them.
Dave
-----Original Message----- From: ProFox [mailto:profox-bounces@leafe.com] On Behalf Of Paul Newton Sent: 10 February 2016 13:20 To: profox@leafe.com Subject: .NET equivalent of VFP SQL Pass-Through (i.e. without using EF or LINQ)
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?
Many thanks
Paul Newton
[excessive quoting removed by server]