I m facing problem in Update operation,Select operation is completed.
To Perform Update operation-
1)Add Class Products
2) Add a new method called UpdateProducts
below is the Vb code,but i want to work with C# Code
Public Sub updateProducts(ByVal ProductID As Integer, _
ByVal ProductName As String, _
ByVal SupplierID As Integer, _
ByVal CategoryID As Integer, _
ByVal QuantityPerUnit As String, _
ByVal UnitPrice As Double)
Dim conn As New SqlConnection("Server=(local);Integrated
Security=True;Database=Northwind;Persist Security
Info=True")
Dim adapter As New SqlDataAdapter("SELECT * FROM Products WHERE ProductID=" & ProductID, conn)
Dim ds As New DataSet
adapter.Fill(ds, "Products")
With ds.Tables(0).Rows(0)
.Item("ProductName") = ProductName
.Item("SupplierID") = SupplierID
.Item("CategoryID") = CategoryID
.Item("QuantityPerUnit") = QuantityPerUnit
.Item("UnitPrice") = UnitPrice
End With
Dim cb As New SqlCommandBuilder(adapter)
adapter.Update(ds, "Products")
End Sub
C# Code-
public class Products
{
void UpdateProducts(int UID, string firstname, string LastName, string EMail, string Address, string phoneNumb)
{
SqlConnection conn = new SqlConnection("Data Source=(local);Initial Catalog=ProductsDB;User ID=gaurav;Password=gaurav");
SqlDataAdapter da = new SqlDataAdapter("Select * from ProductsTable", conn);
DataSet ds = new DataSet();
da.Fill(ds, "ProductsTable");
I NEED CODE HERE
Help me in converting VB Code to C# Code.