codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  connecting to Data.SqlClient  mambojerry at 15:46 on Wednesday, January 16, 2008
 

I am a new asp.net user and I am trying to use this peace of code inorder to
send data from the website to a console and email address. I have managed to
write all the required functions, but when it comes to sqlConnection and sending
the data, that is way all goes wrong

This is the code I am using


Private strConnect As String = "Data
Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\REALLYEASY.mdf;Integrated
Security=True;User Instance=True"

Public Sub dbSave()

Dim toAddress As String = "", Password As String = "", Messagebody As
String = "", ClientEmail As String = ""

Get_Client_Details(toAddress, Password, ClientEmail)
'the function above returns the requred strings

Messagebody = Render_msgBody()


Dim FromAddress As String = "mail@reallyeasy.com"
Dim Subject As String = "Online Build"

Dim cnn As New SqlConnection(strConnect)
cnn.Open()
Dim cmd As SqlCommand
Dim sqlString As String

'To console
sqlString = "PH_EMailOutConsole_New " & ClientID.ToString & ",'" &
FromAddress & "','" & Password & "','" & toAddress & "','" & Subject & "','" &
Messagebody & "','',''"
cmd = New SqlCommand(sqlString, cnn)
cmd.ExecuteNonQuery()


'To client Email
Subject = OfficeName.otherNames & " - More details"
Messagebody = vbCrLf & "Contacts Email Address:" & ContactDetails.CareOf
& vbCrLf & vbCrLf
Messagebody = Messagebody & AutherDetails.Additionalinformation

sqlString = "PH_EMailOut_New " & ClientID.ToString & ",'" & FromAddress
& "','" & Password & "','" & ClientEmail & "','" & Subject & "','" & Messagebody
& "','',''"
cmd = New SqlCommand(sqlString, cnn)
cmd.ExecuteNonQuery()

cnn.Close()


End Sub


any help would be much appreaciated

J








CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums
//








Recent Forum Threads
•  Re: adding a single \ to text
•  Re: problem with STDIN func.
•  Re: Problem with concatenation
•  facing problem in enabling a check box
•  connecting to Data.SqlClient
•  Re: display an image held in a sql database (image datatype) in to a datalist
•  I NEED C++ FOR PCSX2
•  download files via http in perl
•  Re: Help: Trouble with z-Index and SELECT lists


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2008