Re: UPDATE using params, again, deosn't work

From: William Ryan eMVP (dotnetguru_at_comcast.nospam.net)
Date: 05/05/04


Date: Wed, 5 May 2004 07:39:17 -0400

Thought I'd hear back from you, but let me know if it's still not working.
i'm heading to work know, but will be there in about a 45 minutes - I'll
check when I get in .
"dazzalondon" <anonymous@discussions.microsoft.com> wrote in message
news:50C284A9-46EC-4BB5-8EFC-BB5AF7ED9276@microsoft.com...
> I move a step forward, then I have to spend a day on 1 little problem. VS
isn't impressing me anymore. I have deadlines to meet and it is just too
damn easy to get error pages.
>
> Enough of the moan, the mistake is me, I know, but why oh why oh why does
this statement not update my SQL Server DB:
>
> ****
> Dim str As String
> Dim con2 As SqlConnection
> Dim cmdUPDATE As SqlCommand
> Dim intUpdateCount As Integer
>
> con2 = New SqlConnection("xxxxxxx")
>
> str = "UPDATE ClientDetails SET ContactTitle=@Title,
ContactFirstName=@FirstName, ContactLastName=@Surname, Tel=@Tel,
HospContactPosition=@Position, Fax=@Fax, Add1=@Add1, Add2=@Add2, Add3=@Add3,
Add4=@Add4, PostCode=@PostCode, OrgName=@OrgName WHERE Email='" & stateEmail
& "'"
>
> cmdUPDATE = New SqlCommand(str, con2)
>
> cmdUPDATE.Parameters.Add("@Title", SqlDbType.NVarChar, 50).Value =
txtTitle.Text
> cmdUPDATE.Parameters.Add("@FirstName", SqlDbType.NVarChar,
50).Value = Fname.Text
> cmdUPDATE.Parameters.Add("@Surname", SqlDbType.NVarChar, 50).Value
= Sname.Text
> cmdUPDATE.Parameters.Add("@Tel", SqlDbType.NVarChar, 50).Value =
Tel.Text
> cmdUPDATE.Parameters.Add("@Position", SqlDbType.NVarChar,
50).Value = txtPosition.Text
> cmdUPDATE.Parameters.Add("@Fax", SqlDbType.NVarChar, 50).Value =
Fax.Text
> cmdUPDATE.Parameters.Add("@Add1", SqlDbType.NVarChar, 50).Value =
Add1.Text
> cmdUPDATE.Parameters.Add("@Add2", SqlDbType.NVarChar, 50).Value =
Add2.Text
> cmdUPDATE.Parameters.Add("@Add3", SqlDbType.NVarChar, 50).Value =
Add3.Text
> cmdUPDATE.Parameters.Add("@Add4", SqlDbType.NVarChar, 50).Value =
Add4.Text
> cmdUPDATE.Parameters.Add("@PostCode", SqlDbType.NVarChar,
10).Value = PostCode.Text
> cmdUPDATE.Parameters.Add("@OrgName", SqlDbType.NVarChar, 50).Value
= txtOrgName.Text
> con2.Open()
> cmdUPDATE.ExecuteNonQuery()
> con2.Close()
>
> Response.Redirect("PersonalDetailsUpdated.aspx")
>
> please please help
>



Relevant Pages

  • Re: Anführungszeichen in String escapen
    ... wie kann ich doppelte und einfache Anführungszeichen in einem String ... > so dass man sie auch in MS SQL Server eingeben kann???? ... Wenn Du unter einfache Anführungszeichen das " verstehst und unter doppelte ... Dim str As String ...
    (microsoft.public.de.german.entwickler.dotnet.vb)
  • Re: how to "flatten" a list
    ... everything under that heading is a pretty common need. ... Function Concatenate(strSQL As String, Optional strDelimiter As String = ", ... Dim rs As DAO.Recordset ... Dim strReturn As String ...
    (microsoft.public.access.queries)
  • Re: generating dynamic heading images
    ... each corresponding to a letter in the string that is being ... > turned into a graphical heading. ... > find is the GD technique of FIR. ... > I need to - break a string apart an then count the individual letters ...
    (comp.lang.php)
  • Need to find the value within a matrix / table based on two other values
    ... "BPC". ... There is a text string that goes with each combination of heading ... me the string of the cell in the matrix to which they both correspond. ...
    (microsoft.public.excel.programming)
  • String and number manipulation
    ... I am evaluating cells for heading and numbers, ... that in 90% of the cases the numbers are simply 5 digits long and can easily ... is that I am going to have to hold the value as a string - take the parts of ...
    (microsoft.public.excel)