Help Needed

  • Thread starter Thread starter Mike
  • Start date Start date
M

Mike

Hello

I wounder if anybody could help me. I am new to C# and want to write a
script that handles feedback from my customer etc on my website. I have
looked around the internet and have not found any examples.

Thank you for your help

mike
 
Mike:

All you need to do is drag and drop your controls onto a form that will
allow the user the enter the feedback. Then, if you have a good backend
like SQL Server/Oracle, DB2 etc, create a stored procedure for the update.
Otherwise you'll have to use Dynamic SQL. Make each of the control values a
Paramater (Look up IDBParameter, on MSDN for examples). Then, open up a
connection, declare a command object and set the commandtext to the name of
the proc or your sql string, set its connection to the connection you just
declared. Add each of the parameters to the Command's Parameters
collection.

Finally, call the .ExecuteNonQuery method. YOu can actually do most of this
by dragging connections and the like onto your form and it probably won't
take more than 10 lines of code (depending on the number of parameters) to
do this.

Check MSDN out for .ExecuteNonQuery (or google), there's tons of stuff out
there.

HTH,

Bill
 
Thanks for the help.
What I need is for the form then to be e-mailed to me with the information.
Any ideas ?
 
This should get you started, hope it helps!(note it uses CDO, so make sure
you're up to date)

(assumes the presence of several textboxes)

using System.Web.Mail;

System.Web.Mail.MailMessage newMail = new System.Web.Mail.MailMessage();

his.newMail.To = this.textbox1.Text;

this.newMail.Subject = this.textBox2.Text;

this.newMail.From = "your return address";

this.newMail.Body = this.richTextBox.Text;

try

{

SmtpMail.SmtpServer = "your mail server address(www.mymail.com)";

SmtpMail.Send(this.newMail);

MessageBox.Show("Message Sent Successfully");

}

catch( System.Web.HttpException ehttp)

{

MessageBox.Show(ehttp.Message);

}
 
Back
Top