RE: Newbie SQL Queston on INSERT

From: Chaim (Chaim_at_discussions.microsoft.com)
Date: 03/18/05


Date: Fri, 18 Mar 2005 10:29:04 -0800

I'm also not sure about the 'new' in your initialization of str. It seems
that it should probably just read:
       dim str as string = "First Record"

But that's just my guess from reading the grammar and following the links in
the VB.NET Language Spec. The 'New' seems to be used to create a new object
reference. You aren't creating a new object, just assigning a literal.

"Dennis" wrote:

> I am trying to get my SQL statement correct for inserting data into a column
> using a string variable in VB.Net. Following is my code:
>
> dim str as string = new "First Record"
> DBCmd.CommandText = "INSERT INTO Items (Title) VALUES (str)"
> DBCmd.ExecuteNonQuery()
>
> The value it puts into the Title Field is "str" not "First Record". What am
> I doing wrong?
> --
> Dennis in Houston



Relevant Pages

  • Re: If only everybody were carrying Barretts 82A1/M107q, AK47s or RPGs OT
    ... "Dennis " wrote in message ... >>> going to school and reading a lot. ... But your reading comprehension abilities and mine have been tested here ...
    (rec.scuba)
  • Re: How has Christ touched you in your every-day life?
    ... gosh that was nice you missed me. ... the others also but i was not reading here much as it would have made me ... ok i see i signed "me" but its ME, faith. ... i like to think dennis did that to make ...
    (soc.religion.quaker)
  • Re: x-cad
    ... I am sorry Dennis I don't know enough about the product to comment vs. SW. ... Perhaps someone reading here has experience with it or you could try their ... less...most probably you are stepping back in time with functionality but ...
    (comp.cad.solidworks)
  • Re: Wife scared to dive due to "Open Water" movie
    ... >> Dennis (Icarus) wrote: ... >> I think you've been reading too much into it. ...
    (rec.scuba)
  • Re: Scorpion Down
    ... tsalagiNOSPAM@xxxxxxxx (Dennis) wrote: ... reading about the three early Cold War SSKs, of which Barracuda was ...
    (sci.military.naval)