Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Aug 05, 2010 02:20 AM by ketan_al
Member
277 Points
618 Posts
Aug 05, 2010 02:07 AM|LINK
How can i insert NULL value in db column from vb.net code behind sql query?
myCommand.CommandText = "UPDATE db_admin.tblContent " _ & "SET Headline='" & valHead & "', " _ & "Standfirst='" & valStandfirst & "'," _ & "Thumbnail='" & valThumbnail & "'," _ & "MainImage='" & valMainImage & "'," _ & "MetaDescription='" & valMetaDescription & "'," _ & "MetaKeyWords='" & valMetaKeyWords & "'," _ & "Article='" & valArticle & "'," _ & "URLTitle='NULL' " _ & "WHERE ContentID = " & qID myCommand.CommandText = "UPDATE db_admin.tblContent " _ & "SET Headline='" & valHead & "', " _ & "Standfirst='" & valStandfirst & "'," _ & "Thumbnail='" & valThumbnail & "'," _ & "MainImage='" & valMainImage & "'," _ & "MetaDescription='" & valMetaDescription & "'," _ & "MetaKeyWords='" & valMetaKeyWords & "'," _ & "Article='" & valArticle & "'," _ & "URLTitle='' " _ & "WHERE ContentID = " & qID
All-Star
53942 Points
8147 Posts
Aug 05, 2010 02:18 AM|LINK
sheraz_aries & "URLTitle='NULL' " _
Insert NULL instead of 'NULL'
That should insert NULL value into the column
Contributor
6850 Points
1143 Posts
Aug 05, 2010 02:20 AM|LINK
Hi,
Yiu can use Nothing to pass null value. Please refer following
myCommand.CommandText = "UPDATE db_admin.tblContent " _ & "SET Headline='" & valHead & "', " _ & "Standfirst='" & valStandfirst & "'," _ & "Thumbnail='" & valThumbnail & "'," _ & "MainImage='" & valMainImage & "'," _ & "MetaDescription='" & valMetaDescription & "'," _ & "MetaKeyWords='" & valMetaKeyWords & "'," _ & "Article='" & valArticle & "'," _ & "URLTitle=" & Nothing & " " _ & "WHERE ContentID = " & qID
sheraz_aries
Member
277 Points
618 Posts
insert null value
Aug 05, 2010 02:07 AM|LINK
How can i insert NULL value in db column from vb.net code behind sql query?
myCommand.CommandText = "UPDATE db_admin.tblContent " _ & "SET Headline='" & valHead & "', " _ & "Standfirst='" & valStandfirst & "'," _ & "Thumbnail='" & valThumbnail & "'," _ & "MainImage='" & valMainImage & "'," _ & "MetaDescription='" & valMetaDescription & "'," _ & "MetaKeyWords='" & valMetaKeyWords & "'," _ & "Article='" & valArticle & "'," _ & "URLTitle='NULL' " _ & "WHERE ContentID = " & qID myCommand.CommandText = "UPDATE db_admin.tblContent " _ & "SET Headline='" & valHead & "', " _ & "Standfirst='" & valStandfirst & "'," _ & "Thumbnail='" & valThumbnail & "'," _ & "MainImage='" & valMainImage & "'," _ & "MetaDescription='" & valMetaDescription & "'," _ & "MetaKeyWords='" & valMetaKeyWords & "'," _ & "Article='" & valArticle & "'," _ & "URLTitle='' " _ & "WHERE ContentID = " & qIDI tried the queries above but one leave the cell empty while other leave the cell will string 'NULL' but its not the null you get when you manually type NULL by opening the table in edit mode.
sansan
All-Star
53942 Points
8147 Posts
Re: insert null value
Aug 05, 2010 02:18 AM|LINK
Insert NULL instead of 'NULL'
That should insert NULL value into the column
ketan_al
Contributor
6850 Points
1143 Posts
Re: insert null value
Aug 05, 2010 02:20 AM|LINK
Hi,
Yiu can use Nothing to pass null value. Please refer following
hope this helps
MCP, MCTS ( ASP.NET 3.5 )
Please mark as answer if it helps :)