RE: Newbie SQL Queston on INSERT
From: Chaim (Chaim_at_discussions.microsoft.com)
Date: 03/18/05
- Next message: Mark J. McGinty: "Re: Newbie SQL Queston on INSERT"
- Previous message: Chaim: "RE: Newbie SQL Queston on INSERT"
- In reply to: Dennis: "Newbie SQL Queston on INSERT"
- Next in thread: Mark J. McGinty: "Re: Newbie SQL Queston on INSERT"
- Reply: Mark J. McGinty: "Re: Newbie SQL Queston on INSERT"
- Messages sorted by: [ date ] [ thread ]
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
- Next message: Mark J. McGinty: "Re: Newbie SQL Queston on INSERT"
- Previous message: Chaim: "RE: Newbie SQL Queston on INSERT"
- In reply to: Dennis: "Newbie SQL Queston on INSERT"
- Next in thread: Mark J. McGinty: "Re: Newbie SQL Queston on INSERT"
- Reply: Mark J. McGinty: "Re: Newbie SQL Queston on INSERT"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|
|