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
  1. Home
  2. General Programming
  3. C#
  4. Send SQL Query liike email

Send SQL Query liike email

Scheduled Pinned Locked Moved C#
databasehelpquestionsales
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    Burim Rama
    wrote on last edited by
    #1

    Hey Experts ;-) I have a littel problem maybe som of experts can help me: I have this code to select somthing for sql database, now i need to send this query like email, how can i send the Dataset like email ? The code: int Customerid =(int)(dr["CustomerId"]); string customer = dr["Customer"].ToString(); SqlCommand cmd2 = new SqlCommand("licensesexpireddato", con); cmd2.CommandType = CommandType.StoredProcedure; cmd2.Parameters.AddWithValue("@KundeID", Customerid); DataSet ForDataset = new DataSet(); SqlDataAdapter da2 = new SqlDataAdapter(cmd2); da2.Fill(ForDataset); cmd2.ExecuteNonQuery(); I hope i can help me, sorry my english.

    K M 2 Replies Last reply
    0
    • B Burim Rama

      Hey Experts ;-) I have a littel problem maybe som of experts can help me: I have this code to select somthing for sql database, now i need to send this query like email, how can i send the Dataset like email ? The code: int Customerid =(int)(dr["CustomerId"]); string customer = dr["Customer"].ToString(); SqlCommand cmd2 = new SqlCommand("licensesexpireddato", con); cmd2.CommandType = CommandType.StoredProcedure; cmd2.Parameters.AddWithValue("@KundeID", Customerid); DataSet ForDataset = new DataSet(); SqlDataAdapter da2 = new SqlDataAdapter(cmd2); da2.Fill(ForDataset); cmd2.ExecuteNonQuery(); I hope i can help me, sorry my english.

      K Offline
      K Offline
      Keith Barrow
      wrote on last edited by
      #2

      You can't send it directly as e-mail as the object would need to be marshalled across an application boundary. One of the following is probably what you need: 1. Expose your method in a WCF/Web service 2. Google "Serialization", which allows you to write objects out as text.

      Dalek Dave: There are many words that some find offensive, Homosexuality, Alcoholism, Religion, Visual Basic, Manchester United, Butter. Pete o'Hanlon: If it wasn't insulting tools, I'd say you were dumber than a bag of spanners.

      1 Reply Last reply
      0
      • B Burim Rama

        Hey Experts ;-) I have a littel problem maybe som of experts can help me: I have this code to select somthing for sql database, now i need to send this query like email, how can i send the Dataset like email ? The code: int Customerid =(int)(dr["CustomerId"]); string customer = dr["Customer"].ToString(); SqlCommand cmd2 = new SqlCommand("licensesexpireddato", con); cmd2.CommandType = CommandType.StoredProcedure; cmd2.Parameters.AddWithValue("@KundeID", Customerid); DataSet ForDataset = new DataSet(); SqlDataAdapter da2 = new SqlDataAdapter(cmd2); da2.Fill(ForDataset); cmd2.ExecuteNonQuery(); I hope i can help me, sorry my english.

        M Offline
        M Offline
        Mirko1980
        wrote on last edited by
        #3

        A dataset is an XML document, so you could use an XSLT transform to convert your dataset XML to text or HTML, then send it to an email recipient.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

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