Problem with Data Binding !!??

Results 1 to 2 of 2

Thread: Problem with Data Binding !!??

  1. #1
    Join Date
    Dec 1969
    Posts
    309

    Default Problem with Data Binding !!??

    I followed the sample from a book regarding data binding. It seems like I have the problem with data source "datasrc" and Id. <BR>but i don&#039t know how to fix it. can anyone help me with this.<BR>thanks<BR><BR>&#060;&#060;OBJECT classid="clsid:BD96C556-65A3-11D0-983A-00C04FC29E33" id="Data" height="19" width="26"&#062;<BR> &#060;PARAM name="Server" value="http://kat1_xps400"&#062;<BR> &#060;PARAM name="Connect" value="DSN=KAData"&#062;<BR> &#060;PARAM name="SQL" value="select * from UniqueApps"&#062;<BR> &#060;PARAM name="SortColumn" value="Manufacturer"&#062;<BR>&#060;/OBJECT&#062;<BR><BR> &#060;TABLE width="300"&#062;<BR> &#060;TR&#062;<BR> &#060;TD style="text-align: right" width="75"&#062;&#060;B&#062;PUBLISHER:&#060;/B&#062;&#060;/TD&#062;<BR> &#060;TD width="225" colspan="3"&#062;&#060;B&#062;&#060;INPUT id="txtPublisher" type="text" size="40" datasrc="#Data" datafld="Manufacturer" value="Initializing ... please wait ..." name="text"&#062;&#060;/B&#062;&#060;/TD&#062;<BR> &#060;/TR&#062;<BR> &#060;TR&#062;<BR> &#060;TD style="text-align: right" width="100"&#062;&#060;B&#062;PRODUCT:&#060;/B&#062;&#060;/TD&#062;<BR> &#060;TD width="227" colspan="3"&#062;&#060;INPUT id="txtProduct" type="text" size="40" datasrc="#Data" datafld="Product" value=" " name="PRODUCT"&#062;&#060;/TD&#062;<BR> &#060;/TR&#062;<BR> &#060;TR&#062;<BR> &#060;TD style="text-align: right" width="100"&#062;&#060;B&#062;VERSION:&#060;/B&#062;&#060;/TD&#062;<BR> &#060;TD width="75"&#062;&#060;INPUT id="txtMainapps" type="text" size="13" datasrc="#Data" datafld="Version" name="Version"&#062;&#060;/TD&#062;<BR> &#060;TD width="75" align="right"&#062;&#060;B&#062;MAIN APPS:&#060;/B&#062;&#060;/TD&#062;<BR>

  2. #2
    Jason Buck Guest

    Default RE: Problem with Data Binding !!??

    This is how I do my data binding.<BR><BR>I would guess that your data is in two seperate tables.<BR><BR><BR>&#060;form method="Post" action="updateclient.asp"&#062;<BR><BR>&#060;table &#062;<BR><BR>&#039********This code call the information from the main table where the Item you want to bind is a number field. IE my state field<BR>&#060;%<BR><BR>strClientID = request.querystring("climat")<BR>Response.write strClientID<BR><BR>strConnect = "Driver={Microsoft Access Driver (*.mdb)}; DBQ=C:database e1.mdb"<BR><BR>dim objconn, objrec, mysql, strStatus, Mytest, strLength<BR>set objconn = server.createobject("ADODB.Connection")<BR><BR><BR >objConn.open strConnect<BR><BR><BR>mysql = "SELECT CLIENT.CLIMAT, CLIENT.CLINAME, CLIENT.STATE, CLIENT.HUSB_DOB, CLIENT.WIFE_DOB, CLIENT.RESP_ATTY, CLIENT.CORP_FIDUC, CLIENT.ATTY_FIDUC, CLIENT.HUASSET, CLIENT.WIASSET, CLIENT.COASSET, CLIENT.MEMO, CLIENT.ORIGDATE, CLIENT.MODDATE, CLIENT.MODTIME, CLIENT.MODWHO, CLIENT.OFFICE FROM CLIENT WHERE (((Client.Climat)=&#039" & strClientID & "&#039));"<BR><BR><BR><BR><BR>set rstemp = objConn.execute(mysql)<BR><BR> <BR>strClimat = rstemp("CLIMAT")<BR>strCliname = rstemp("CLINAME")<BR>strState = rstemp("state")<BR>strhusbdob = rstemp("husb_dob")<BR>strwifedob = rstemp("wife_dob")<BR>strrespatty = rstemp("resp_atty")<BR>strcorpfid = rstemp("corp_fiduc")<BR>strattyfid = rstemp("atty_fiduc")<BR>strhuasset = rstemp("huasset")<BR>strwiasset = rstemp("wiasset")<BR>strcoasset = rstemp("coasset")<BR>strmemo = rstemp("memo")<BR>strorgdate = rstemp("origdate")<BR>strmoddate = rstemp("moddate")<BR>strmodtime = rstemp("modtime")<BR>strmodwho = rstemp("modwho")<BR>stroffice = rstemp("office")<BR><BR><BR>&#039howmanyfields=rst emp.fields.count -1<BR><BR>If not rstemp.eof then<BR><BR><BR> Do While Not rstemp.EOF<BR><BR> rstemp.movenext<BR> Loop<BR><BR> <BR><BR>End if<BR>rstemp.close<BR><BR>%&#062;<BR><BR><BR>&#060 ;tr&#062;<BR>&#060;td&#062;Climat&#060;/td&#062;&#060;input type="hidden" name="climat" size="20" value="&#060;%=strClimat%&#062;"&#062;&#060;/td&#062;<BR>&#060;/tr&#062;<BR>&#060;tr&#062;<BR>&#060;td&#062;Clien t Name&#060;/td&#062;&#060;td&#062;&#060;input type="text" name="cliname" size="40" value="&#060;%=strCliname%&#062;"&#062;&#060;/td&#062;<BR>&#060;/tr&#062;<BR>&#060;tr&#062;<BR><BR>&#039**** Hide the value of state from your main table<BR>&#060;td&#062;State&#060;/td&#062;&#060;td&#062;&#060;input type="Hidden" name="state" size="04" value="&#060;%=strState%&#062;"&#062;<BR><BR>&#039 **** This is where I Bind my state field from the state table to StateID field in the Client Table. The state id is above.<BR>The state table is queried below.<BR><BR>&#060;%<BR>mysql = "SELECT state.id, state.name FROM state WHERE (((state.id)&#062;&#039""&#039));"<BR>&#039***** This queries all state values greater than null<BR><BR>set rstemp=objConn.execute(mysql)<BR><BR><BR>response. write "&#060;select name=&#039selstate&#039&#062;"<BR>&#039****** This is the name of the listbox in case you are posting the data somewhere.<BR><BR><BR>If not rstemp.eof then<BR><BR><BR> Do While Not rstemp.EOF<BR>strstateValue = rstemp("id")<BR>strst = rstemp("name")<BR> If strstate = strstateValue Then<BR>&#039**** The above line is the BIND it is saying if strstate (value from the main table is = strstateValue, the value of the state from the state table. Then show that value. <BR><BR> response.write "&#060;Option Selected value=" & strstateValue & "&#062;" & strst & "&#060;/option&#062;"<BR> Else<BR>&#039**** This is say write all the other states from the state table that are not equal to strstate. Which would be the other 49 states.<BR><BR> response.write "&#060;Option value=" & strstateValue & "&#062;" & strst & "&#060;/option&#062;"<BR> End if<BR> rstemp.movenext<BR> Loop<BR><BR> <BR>response.write "&#060;/select&#062;"<BR>End if<BR><BR> rstemp.close<BR> <BR><BR><BR>%&#062;<BR><BR><BR><BR>&#060;/td&#062;<BR>&#060;/tr&#062;<BR><BR><BR>I hope that I have explain this clearly.<BR><BR>If not, please feel free to contact me.<BR><BR>Respectfully,<BR><BR>Jason<BR>webmaster @wnj.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •