converting string to uniqueidentifier

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hi,

i am trying to insert data into sql server db using ado.net (vb.net) thru an
insert statement. I have a uniqueidentifier field in the table and asp.net
converts it to guid field and when i put guid.toString value in insert
statement

sql server exception occurs sayings cant convert string to uniqueidentifier
 
Hi,

Instead you should really use parametrised statements.
Check out .net help on this.
It will be easier and more safe for you.
 
There should be no problem to do this but make sure your query
is correctly formatted, including ' and ' around the guid you send in.

PL.
 
i figuried it out. you have to do ..

"'{" & (new guid(str)).toString("D") & "}'"


its weird but u have to convert the string back to guid n thn nother string
 
Back
Top