Send SQL Query liike email
-
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.
-
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.
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.
-
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.