Showing posts with label compilation. Show all posts
Showing posts with label compilation. Show all posts

Monday, March 26, 2012

escaping single quotes

Hi,

I need to have an varchar value with single quotes. For eg: the below code throws compilation error.

Declare @.val VARCHAR(20)
SELECT @.val = ''+name+''
print @.val

Error: Invalid column 'name'

I want to print name enclosed with single quotes. Please guide me.

Regards,
SamDeclare @.val VARCHAR(20)
SELECT @.val = 'Kaiowas'
PRINT @.VAL

EDIT (added): SET @.VAL = @.VAL + '''Kaiowas'''
EDIT (added): PRINT @.VAL

SET @.VAL = @.VAL + '''' + @.VAL + ''''
PRINT @.VAL

Sunday, February 26, 2012

Error:Type Expected

I did create one simple program which is used to retrieve data from SQL Server Database into the DataGrid. Unfortunately,compilation stops at the position that 'Dim conn as SQLConnection'.The error is just same as the subject 'Type Expected'.

By the way, the default frameworkSDK from VS.NET version 1.0 lies different place from .NET1.1 I did install recently.If so, I wonder which FrameworkSDK will be used if I'm intending to compile ASP.NET Web Application.

Looking forward to your timely kind reply!At the top of your page with the code, are you importing the System.Data namespace?

Imports System.Data

Josh