Source language: Translate to:

Adding new field problem

Questions about our Advanced Database plug-in

Moderator: Neosoft Support

Adding new field problem

Postby KenHos » Wed Mar 23, 2016 2:20 pm

I created a database. Created a table. Latter I needed to add another field. It says it's there but no data can be entered. I can see it in the field. But when I close out and run the program again, it's not there. What? Please help! Sorry if this is simple and I'm just missing it. Old dbase programmer just learning!
KenHos
 
Posts: 11
Joined: Fri Jan 11, 2013 11:21 am

Re: Adding new field problem

Postby Rasl » Thu Mar 24, 2016 7:40 am

What kind of database are you using?
MSSQL, MySQL , SQLite , Access, dbf
Rasl
 
Posts: 129
Joined: Sat Apr 02, 2005 8:25 am
Location: Buenos Aires, Argentina

Re: what kind

Postby KenHos » Thu Mar 24, 2016 10:02 am

access
KenHos
 
Posts: 11
Joined: Fri Jan 11, 2013 11:21 am

Re: Adding new field problem

Postby Gaev » Thu Mar 24, 2016 1:26 pm

KenHos:

Your descriptions are not very clear.

It says it's there

Please show us the code you are using e.g. something like ...
Code: Select all
dbpShowErrors "Yes"

dbpOpenAccessDatabase "myDB" "etc. etc." ""
dbpOpenTable "myDB" "myTable" ""

dbpGetFieldDefs "myDB" "myTable" "[#13]" "[TextEntry1]"
dbpAddfield "myDB" "myTable" "myNewFieldName" "myNewFieldDefinition"
dbpGetFieldDefs "myDB" "myTable" "[#13]" "[TextEntry2]"
AlertBox "RecordCount" "[myDB.myTable.$RecNum]"

... and post the results you are seeing in TextEntry1 and TextEntry2 ... as well as the current record number returned by the AlertBox.

but no data can be entered.

Did you try something like ...
Code: Select all
SetVar "[myDB.myTable.myNewFieldName]" "qwerty"

... or were you trying to use the Grid ?

I can see it in the field.

a) Where can you see it ? ... in the Grid ?
b) what can you see ? ... the column for the new field in the Grid ?
User avatar
Gaev
 
Posts: 3738
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Re: Adding new field problem

Postby KenHos » Thu Mar 24, 2016 5:58 pm

Using grid, but Not in the grid!
There are nine entry boxes or field boxes. Eight work One doesn't. Same code, different field names. Was using six added three and two of three added fine. One didn't.
Last edited by KenHos on Thu Mar 24, 2016 6:07 pm, edited 2 times in total.
KenHos
 
Posts: 11
Joined: Fri Jan 11, 2013 11:21 am

Re: Adding new field problem

Postby KenHos » Thu Mar 24, 2016 6:01 pm

SetVar "[mScr]" "[worship.words.blank]"
FileExists "[PubDir]Worship.exe" "[mRESULT]"
If "[mRESULT]" "<" ""
dbpCreateAccessDatabase "worship" "Password=;Encrypted=No"
dbpOpenAccessDatabase "worship" "worship" ""
dbpCreateTable "worship" "words" "list Boolean;song String(50);verse1 String(500);verse2 String(500);verse3 String(500);verse4 String(500);verse5 String(500);verse6 String(500);chorus String (500);chorus2 String(499);bridge String(499);font Char(2);blank Char(8)"
dbpOpenTable "worship" "words" ""
Else
dbpOpenAccessDatabase "worship" "worship" ""
dbpOpenTable "worship" "words" ""
Endif

.....
dbpSetAutoEdit "worship" "words" "Yes"
dbpShowGrid "worship" "words" "b1"
dbpSetColumnOrder "worship" "words" "list;song"
dbpSetColumnWidths "worship" "words" ""
dbpSetGridProperties "worship" "words" "Font=Arial,11,Bold,ANSI_CHARSET;RowHeight=24;AllowRowResize=No;AllowColumnResize=No;AllowColumnSort=Yes;ConfirmDelete=No;ReadOnly=No;EditOnly=No;RowSelect=Yes;ShowScrollBars=Vertical;ShowNavigationBar=No;GetDefaultValues=No;OnDoubleClick=test;OnRightClick=test2"
dbpSetFieldProperties "worship" "words" "list" "PickList= ;DropDownRows=7"
dbpSetFieldProperties "worship" "words" "song" "ColumnWidth=210"
......
dbpSort "worship" "words" "song=ASC"

This a lyrics presentation program for my Church. It work great until I added 3 new fields

dbpCreateTable "worship" "words" "list Boolean;song String(50);verse1 String(500);verse2 String(500);verse3 String(500);verse4 String(500);verse5 String(500);verse6 String(500);chorus String(500);chorus2 String(499);bridge String(499);font Char(2);blank Char(8)"

dbpOpenTable "worship" "words" "" Verse6, chorus2, bridge are new. bridge does not work.

Remember, I am old School dbase\Clipper programmer. In my day, I was one of the best. 38 years ago! Awe such changes! Walk away and have been pastoring a Baptist Church for 29 years. Just getting back in the last two years.
KenHos
 
Posts: 11
Joined: Fri Jan 11, 2013 11:21 am

Re: Adding new field problem

Postby Gaev » Thu Mar 24, 2016 6:45 pm

KenHos:

I am guessing that you did not add field(s) to an existing Database using the dbpAddField command (as I imagined) ... but recreated the database from scratch (adding fields to the dbpCreateTable command) ... and encountered problems when the additional fields caused you to exceed the limit for the maximum record size in an Access Table.

Over here ... http://webcheatsheet.com/sql/access_specification.php ... you will see that even when using MS Access 2007 or MS Access 2003, the limit is 4,000 bytes (for earlier versions, it is 2,048).

The number of bytes in your dbpCreateTable is about 4,560 !!!

However, all is not lost ...

a) the limit for records excludes Memo fields.

b) you have a number of String fields each with 500 characters (which exceeds the limit in Access of 255 characters)

... so try again with all your String(500) character fields defined as Memo (each of which can be as large as 65,535 characters).
User avatar
Gaev
 
Posts: 3738
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Re: Adding new field problem

Postby KenHos » Thu Mar 24, 2016 10:05 pm

Thanks Gaev! That work great. So Simple, unless you don't know! Thanks
KenHos
 
Posts: 11
Joined: Fri Jan 11, 2013 11:21 am


Return to NeoBookDBPro

Who is online

Users browsing this forum: No registered users and 1 guest