|
-
Oct 6th, 2005, 06:14 AM
#1
Thread Starter
Fanatic Member
send mail wierd
i have an insert statement on a btn submit comp
this works great
i also have code to send an email,
not sure if it works
when i call my fuction to send the email in my btn send
the email doesnt send and the insert doesnt insert
how messed up is that
it works 60% of the time, all the time.
-
Oct 6th, 2005, 08:04 AM
#2
Addicted Member
Re: send mail wierd
so you got some code for us to look at? any error messages?
-
Oct 6th, 2005, 08:37 AM
#3
Thread Starter
Fanatic Member
Re: send mail wierd
no error messages
my code for submit is just a basic insert satatement
then
i call my send mail function
Private Sub CompRegConfirmation()
Dim msg As New MailMessage
msg.From = "[email protected]"
msg.To = "[email protected]"
msg.Bcc = "[email protected]"
msg.Subject = " Company registered"
msg.Body = "this is a test"
msg.Body = "helo good mornin vietnam"
msg.BodyFormat = MailFormat.Html
SmtpMail.SmtpServer = "localhost"
SmtpMail.Send(msg)
End Sub
so id my submit click i have
insert.........
connection close()
compregconfirmation()
end sub
if i do this then no erors appear, no insert to database, and no email is sent either
it works 60% of the time, all the time.
-
Oct 6th, 2005, 09:09 AM
#4
Fanatic Member
Re: send mail wierd
Can you post the insert statement?
-
Oct 6th, 2005, 09:16 AM
#5
Thread Starter
Fanatic Member
Re: send mail wierd
Dim sqlInsertComp As New SqlCommand("INSERT INTO tb_comp_detail(c_companycode,c_comp_name,c_job_title,c_firstname,c_sname,c_houseno,c_street,c_passwo rd,c_town,c_county,c_country,c_comp_email,c_comp_tel,c_comp_registered,c_comp_enabled) VALUES('" & txtUsername.Text & "','" & txtCompanyName.Text & "','Owner','" & txtFirstName.Text & "','" & txtSurname.Text & "','" & txtHouseNo.Text & "','" & txtStreet.Text & "','" & txtPassword.Text & "','Derry','Derry','uk','" & txtEmailAddress.Text & "','" & txtPhoneNo.Text & "',getDate(),'0');", oSQLConn)
oSQLConn.Open()
sqlInsertComp.ExecuteNonQuery()
oSQLConn.Close()
it works 60% of the time, all the time.
-
Oct 6th, 2005, 09:38 AM
#6
Fanatic Member
-
Oct 6th, 2005, 09:45 AM
#7
Thread Starter
Fanatic Member
it works 60% of the time, all the time.
-
Oct 6th, 2005, 09:49 AM
#8
Fanatic Member
Re: send mail wierd
Are any exceptions or errors displayed? Sometimes when I have code that doesn't do what its supposed to do and also does not display an error it is because of a caught exception.
-
Oct 6th, 2005, 09:50 AM
#9
Fanatic Member
Re: send mail wierd
Is this is an ASP.NET file, or in the CodeBehind vb file? Can you post the entire methods (the _click method)
-
Oct 6th, 2005, 09:58 AM
#10
Thread Starter
Fanatic Member
Re: send mail wierd
the code of the button submit click is just the code above
the insert statement and then call the compregconfirmation method
when i dont call the compregconfirmation the insert works
if i call compregconfirmation in a different button then the email is sent ( on another machine)
but if i try to call it in the button click event
no insert, no email no errors
i have no try catch statements
it is completely baffling i know
if you want me to post the code i will
but its just as above
thanks
Last edited by d2005; Oct 6th, 2005 at 10:01 AM.
it works 60% of the time, all the time.
-
Oct 6th, 2005, 09:10 PM
#11
Fanatic Member
Re: send mail wierd
I'm just guessing at some of the basic mistakes I made when I first started vb. Just make sure the button method looks like this:
Private Sub btnMyButton_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles btnMyButton.Click
Make sure the btnMyButton.Click has the correct button and event name.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|