Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
D

DarthDub

@DarthDub
About
Posts
2
Topics
0
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Send print file to printer, C#
    D DarthDub

    You would be able to just make a console app and use the built in printer class. It should do the trick. I don't know for sure, so sorry.

    Castro

    C# csharp help tutorial

  • Update() database from DataSet
    D DarthDub

    First off do you have your update command made yet? I'll I know how to do with DataAdapters is the sql part of them, but if thats what your doing here is an example. It should be kinda the same type of thing. SqlConnection CNN = new SqlConnection("Data Source=(local);Initial Catalog=Northwind;Integrated Security=true"); SqlDataAdapter DA = new SqlDataAdapter(); DataSet DS = new DataSet(); SqlCommand cmdSelect = CNN.CreateCommand(); cmdSelect.CommandText = "Select CustomerID, ContactName, CompanyName From Customers"; // create an Update command SqlCommand cmdUpdate = CNN.CreateCommand(); cmdUpdate.CommandText = "Update Customers SET CompanyName=@CompanyName, ContactName=@ContactName WHERE CustomerID=@CustomerID"; cmdUpdate.Parameters.Add("@CompanyName", SqlDbType.NVarChar, 40, "CompanyName"); cmdUpdate.Parameters.Add("@ContactName", SqlDbType.NVarChar, 30, "ContactName"); cmdUpdate.Parameters.Add("@CustomerID", SqlDbType.NChar, 5, "CustomerID"); cmdUpdate.Parameters["@CustomerID"].SourceVersion = DataRowVersion.Original; // create an Insert command SqlCommand cmdInsert = CNN.CreateCommand(); cmdInsert.CommandText = "Insert into customers (customerid, companyname, contactname) Values (@customerid, @companyname, @contactname)"; cmdInsert.Parameters.Add("@customerid", SqlDbType.NChar, 5, "customerid"); cmdInsert.Parameters.Add("@companyname", SqlDbType.NVarChar, 40, "companyname"); cmdInsert.Parameters.Add("@contactname", SqlDbType.NVarChar, 30, "contactname"); cmdInsert.Parameters["@customerid"].SourceVersion = DataRowVersion.Original; // create a Delete command SqlCommand cmdDelete = CNN.CreateCommand(); cmdDelete.CommandText = "Delete from customers Where customerid = @customerid"; cmdDelete.Parameters.Add("@customerid", SqlDbType.NChar, 5, "customerid"); cmdDelete.Parameters["@customerid"].SourceVersion = DataRowVersion.Original; DA.SelectCommand = cmdSelect; DA.UpdateCommand = cmdUpdate; DA.InsertCommand = cmdInsert; DA.DeleteCommand = cmdDelete; DA.Fill(DS, "Customers"); //then do whatever you want to with modifying it. //And then just do update like this

    C# database help question announcement
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups