3 Replies - 223 Views - Last Post: 15 January 2018 - 09:10 PM Rate Topic: -----

#1 maytel.mynt   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 28-September 08

stuck with sql datagridview chr(13)

Posted 15 January 2018 - 05:14 PM

how my database looks like

RecNum FieldA FieldB
0      Aa     Ba
1      Ab     Bb


how i want it to be displayed via datagridview
*up to this point i was successfull "select *, FieldA & chr(13) & FieldB as FieldAB..."

RecNum FieldA FiedldAB FieldB
0      Aa     Aa       Ba
              Ba
1      Ab     Ab       Bb
              Bb


when inserting data RecNum = 3, FieldA = Ac and FieldB = Bc
i use the code below to achieve this

RecNum FieldA FiedldAB FieldB
0      Aa     Aa       Ba
              Ba
1      Ab     Ab       Bb
              Bb
2      Ac     Ac       Bc
              Bc


oItemDts.Tables("TableA").Rows.Add(oItemDrw)
oItemAdt.Update(oItemDts, "TableA")

sItemSql = "SELECT *, FieldA & Chr(13) & FieldB FROM TableA WHERE RecNum = 2"
oItemAdt.SelectCommand = New OleDbCommand(sItemSql, oCon, oTran)
oItemDts.Clear()
oItemAdt.Fill(oItemDts, sTableName)
oItemDrw = oItemDts.Tables(sTableName).Rows(0)
oMainDts.Tables(sTableName).ImportRow(oItemDrw)
:code:

my problem is with updating the record, is there an equivalent importrow in updating?
i tried loaddatarow but the itemarray of oMainDrw and oItemDrw is not the same

oMainDrw = oItemDts.Tables(sTableName).LoadDataRow(oItemDrw.ItemArray, True)


note: sSqlMain = "SELECT *, FieldA & Chr(13) & FieldB FROM TableA"

thank you.

This post has been edited by modi123_1: 15 January 2018 - 07:56 PM
Reason for edit:: In the future, please use the [code] tag button in the editor..


Is This A Good Question/Topic? 0
  • +

Replies To: stuck with sql datagridview chr(13)

#2 maytel.mynt   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 28-September 08

Re: stuck with sql datagridview chr(13)

Posted 15 January 2018 - 05:28 PM

file:///D:/Untitled.jpg
Was This Post Helpful? 0
  • +
  • -

#3 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 14092
  • View blog
  • Posts: 56,461
  • Joined: 12-June 08

Re: stuck with sql datagridview chr(13)

Posted 15 January 2018 - 07:59 PM

I am not following.. what are you trying to do?
Was This Post Helpful? 0
  • +
  • -

#4 maytel.mynt   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 28-September 08

Re: stuck with sql datagridview chr(13)

Posted 15 January 2018 - 09:10 PM

select *, FieldA & chr(13) * FieldB AS FieldAB

i was successful in inserting a record
but im having difficulty in updating a record

RecNum FieldA FiedldAB FieldB
0      Aa     Aa       Ba
              Ba
1      Ab     Ab       Bb            
              Bb



if i update record 1 FieldA = Ac and FieldB Bc this is the result

RecNum FieldA FiedldAB FieldB
0      Aa     Aa       Ba
              Ba
1      Ac     Ab       Bc            
              Bb                        



FieldAB does not show the edited value.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1