Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DB Help.

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
0
0
I wrote a program with a dummy access database file with about 25 record. Now that i now my program is working, i imported 45,000 record into the database from an excel file.
My program reads ItemsNo into a combobox and upon select change it show the record details.

Now when i run the program, i can see all the records in the combo box, but upon changing this combo box i can only see first 31 record details and revoles around this 31 records details even if the combo box item is on 32,000.
It works fine if i have 10,000 record.

can someone please help and put some light on why this is happening.
I think it soming to with catching..

I reprogrammed new project with new 45,000 record database, and its still exhibing the same problem.

please helpp.
 
I dont fully understand your description

Now when i run the program, i can see all the records in the combo box, but upon changing this combo box i can only see first 31 record details and revoles around this 31 records details even if the combo box item is on 32,000.
It works fine if i have 10,000 record

and are you using CDAORecordset CRecordset or api calls?

Matt
 
My dialog box has a combo box for itemNo, and edit boxes to show coresponding item detail.
my code goes like this. ( 45,000 record in one table imported from Excel file.)

read databse from start to end.
addstring ItemNo to combo box
get coresponding ItemID
Seek table with this ItemID,Match and get Item Details
show item details
and have onChanSelect ItemNo combo box, show item details.

i am using CDAOrecordset. like i said it works fine with 10,000 records.

is there a limit on records in Access database.

 
I would close the database and not bother with the seek. Instead i would use a SQL statement

CString SQL
SQL.Format("Select * from [My Database] where ItemNo = %d",m_ComboString);

where m_ComboString is a CString attached to the combo box. By calling UpdateData(TRUE) it will be given the data currently in the combo.

Then I would open the database, check if the number of records returned is greater then zero (assumingly yes it will be if combo box is set up correctly.)


See if that help. I have seen problems on having large databases open for a while. Nothing like what you mentioned but more along the lines of trying to do stuff I couldnt do because i left a snapshot view open.

Matt
 
Can some please tell me if ACCESS only takes max of 32767 Records, because this is what i am getting, when i read my database, the program see's last record as the 32,767th record. and program does not read any further then that.
IS THIS TRUE????
is there a way round this or not..

pls help.
thanks in advance
 
I'm guessing this is a limit of the combobox, and not of Access. 32k is the limit for entries in Listbox and Combobox. Maybe you should also ask yourself whether it's reasonable to expect a user to scroll through 32000+ entries... :) Hope that this helped! ;-)
 
Not really, i would not except user to scroll through entire table.
Is there another way of doing this, because i need to show itemno before user can make selection...
Or
how can code that while the user is type ItemNo, the combobox show related itemNo

ie,
While the user tyes in "P0..." the combobox has already pulled record starting with P0... and only this records are shown.. (just incase the user has forgotten full ItemNO.)

Please Help...
Thanks
 
What am i doing wrong here SQL.. pls someone help.

CString SQL;
CString name = m_ItemName; // get input name
UpdateData(TRUE);
CDaoDatabase* pDB = GetDatabase();
TableSet recSet;
recSet.Open();
SQL.Format(" SELECT * FROM ItemTbl WHERE ItemNo = ","P889");
m_text1 = recSet.m_Name;
m_text2 = recSet.m_Name1;

instead of getting corresponding value to P889 i am getting values of the first record in the table.
what am i doing wrong here...
 

Some debugging help please, it says the following Error executing cl.exe. cannot open program database...










//Program couples
#include<fstream.h>
#include<iostream.h>
#include<conio.h>
#include<string.h>
#include<stdlib.h>

struct newint
{
char couples[25];
// char couplesf[25];
// char couplesl[25];
// char couplesm[25];
// char couplest[25];
};

//prototypes
void readdisk(newint [], int &);
void printarray(newint [], int);
void parse(char[], char [], char[], newint [], newint [], int, int);
void sort(newint [], newint [], int);
void printarray2(newint [], int);

void main()
{
int d=0;
newint a[30];
newint b[30];

int k=0;
char mrs[23];
char first[23];
char last[23];




readdisk(a, d);
printarray(a, d);
cout<<endl;
parse(mrs, last, first, a, b, d, k);
sort(a, b, d);
printarray2(a, d);

cout<<endl;
}
//***********************************************
void readdisk(newint a[], int &d)
{
d = 0;
ifstream infile(&quot;c:\\couples.txt&quot;);

while(infile)
{
infile.getline(a[d].couples, 25);
d++;
}
d--;
infile.close();
}
//***********************************************
void printarray(newint a[], int d)
{
int k=0;
for (k=0; k<d; k++)
{
cout<<a[k].couples<<endl;
}
}

//***********************************************


void parse(char first[], char last[], char mrs[], newint a[], newint b[], int d, int k)
{

for (k=0; k<d; k++)
{
char total[30];
strcpy(total, a[k]. couples);
int L=strlen(total);
int pc;
int pc2;
int z=0;

for(int x=L;x>0;x--)
if(total[x]==' ')
{
pc=x;
}

for (x=0; x<pc; x++)
if(total[x]==' ')
{
pc2=x;
}
// mrs[x]='\0';
// cout<<&quot;&quot;<<mrs<<endl;

for (int f=pc+1; f<pc2; f++)
{
first[z]=total[f];
z++;
}
first[z]='\0';
// cout<<&quot;first=&quot;<<first<<endl;
int d=0;
for (int m=pc2+1; m<L+1; m++)
{
last[d]=total[m];
d++;
}
last[d]='\0';
// cout<<&quot;year=&quot;<<year<<endl;
int mrsL=strlen(mrs);
if(mrsL<2)
{
mrs[1]=mrs[0];
mrs[0]='0';
mrs[2]='\0';
}
strcpy(b[k].couples, mrs);
strcat(b[k].couples, first);
strcat(b[k].couples, last);
cout<<(b[k].couples)<<endl;
}
}



//**********************************************
void sort(newint a[], newint b[], int d)
{
newint t;
for (int i=1; i<d; i++)
for (int j=0;j<d-i;j++)
if (strcmp (b[j].couples,b[j+1].couples) > 0)
{
t=a[j];
a[j]=a[j+1];
a[j+1]=t;

t=b[j];
b[j]=b[j+1];
b[j+1]=t;
}
//cout<<(b[k].dates)<<endl;
}
//*****************************************************************************************
void changedates(char mrs[], char first[], char last[], newint a[], newint b[], int d)

{
// char cdate[12];
// char s[15];
char m[12];
char f[12];
char j[12];
for(int i=0; i<15; i++)

{ strcpy(m, b.couples);
mrs[0]=m[2];
mrs[1]=m[3];
mrs[2]='\0';

strcpy(f, b.couples);
first[0]=f[4];
first[1]=f[5];
first[2]='\0';

strcpy(j, b.couples);
last[0]=j[0];
last[1]=j[1];
last[2]='\0';
}

}

//**********************************************************************************************

void printarray2(newint a[], int d)
{
int k=0;
for (k=0; k<d; k++)
{
cout<<a[k].couples<<endl;
}
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top