sql - SqlDataAdapter and Computed Columns; not maintained? -


let's have following sql schema:

sql

table person columns  (     id integer,     firstname varchar(100),     lastname varchar(100),     fullname (firstname + ' ' + lastname) ) go insert person (id, firstname, lastname) values (1, 'simon', 'dugré') go 

vb retreiving class

dim da new sqldataadapter("select id, firstname, lastname, fullname person id = 1", cn) dim ds new dataset() da.fill(ds) da.filleschema(ds) ' tried before or after da.fill, in case '  dim dr datarow = ds.table(0).row(0) assert.istrue(dr("firstname") = "simon") ' returns true ' assert.istrue(dr("lastname") = "dugré") ' returns true ' assert.istrue(dr("fullname") = "simon dugré") ' returns true ' dr("firstname") = "nomis" assert.istrue(dr("fullname") = "nomis dugré") ' return false, still "simon dugré" in it. ' 

while debugging in immediate window, see following:

?dr.table.columns("fullname").computed ' says set false... duhhh... no!' 

more informations

i saw @ few places there way "hardcode" computed column formula directly code referring property instead of sql fields... can't because keep question readable, removed lot of code in fact part of whole abstract , generic scenario.

my question is, there in fact way have formula retrieved directly sql while calling da.fill or da.fillschema or something? then, when changing firstname or lastname, automatically have effect on fullname computed column?

it's not computed in datatable. has no relation how column defined in database :)

there's no direct translation between sql expressions , il, you'll have type in manually, , maintain needed.

of course, if you're dealing simple expressions, it's pretty easy translate them automatically, you'll have write parser. stuff it's not hard.


Comments

Popular posts from this blog

c++ - No viable overloaded operator for references a map -

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - Cannot secure connection using TLS -