c# - Regular Expression for word starting with Colon (:) -


i new regular expression, please me in regards. have sql query below

declare @name varchar(20) declare @branchcode char(3)  select @name=:entername select @branchcode=:enterbranchcode  select * master name=@name , branchcode=@branchcode  

now need replace :entername , :branchcode actual value. trying solve using regular expression.

is regex ok (/\b:\s+/g") ???

all want achieve

collect sql parameter web application dynamically

no, sqlparameters for. in addition creating variables can used within sql, protect against sql injection attacks, you're opening for.

plenty of examples on stack overflow how use them, such this one.

in order parse these out given query prompt user values...

  1. simply take query regular parameters, select * foo bar = @barname
  2. you can regex @barname parameters pretty easy regex @\w+
  3. for each parameter, ask user
    1. the type of parameter
    2. the value of parameter
  4. construct sqlparameter each , add sqlcommand object.

you might able away without 3.1. or might able make best guess based on give you. must ask them explicit.


Comments

Popular posts from this blog

jOOQ update returning clause with Oracle -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -

java - BasicPathUsageException: Cannot join to attribute of basic type -