vb.net - SQL Update Command In Visual Studio -
i'm having trouble update commands in visual studio.
i'll right point.
i have ms access relational database end , have connected in vb , can display records , such can't update. have in form_load
dim strquery string = "select contractid [contract id], productname [product name], signingdate [date signed], startdate [start date], enddate [end date] ((policycontract) inner join clients on policycontract.clientid = clients.clientid) inner join products on policycontract.productid = products.productid policycontract.clientid = '" + clientid + "' order policycontract.contractid;" 'initialise data adapter dapolicycontract = new oledbdataadapter(strquery, connection) 'initialise dataset dsallroundinsurance = new dataset 'fill dataset dapolicycontract.fill(dsallroundinsurance, "policycontract") 'bind data grid data in policycontract table dgvpolicies.datasource = dsallroundinsurance.tables("policycontract") 'autosize columns fit grid size dgvpolicies.autosizecolumnsmode = datagridviewautosizecolumnsmode.fill
it works fine, displays right records want update records.
when click button want update "enddate" value specific contract. when execute command:
update ((policycontract) inner join clients on policycontract.clientid = clients.clientid) inner join products on policycontract.productid = products.productid set policycontract.enddate = '1/1/1111' policycontract.contractid = 'c100102';
in ms access updates correctly, command okay. when try execute command in click event handler this:
dapolicycontract.updatecommand = new oledbcommand("update ((policycontract) inner join clients on policycontract.clientid = clients.clientid) inner join products on policycontract.productid = products.productid set policycontract.enddate = '1/1/1111' policycontract.contractid = 'c100102';", connection)
nothing happens, don't error still doesn't update. i'm pretty sure vb executing command not updating database.
appreciated, thanks.
i see execution of command. have make sure call executenonquery()
on command. otherwise won't executed.
Comments
Post a Comment