|
Allis wrote:
Then,what the ConnectionString of m_pConnection shall look like?
m_pConnection->Open(
_bstr_t(L"Provider=Microsoft.Jet.OLEDB.3.51;Data Source=C:\file.mdb;"),
_bstr_t(L""),
_bstr_t(L""),
adModeUnknown);
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
Thank you.It's OK now
But why does it work only when i cut the path,just write: L"...;Data Source=list.mdb;" ?Otherwise,it will append the path where the application locate,then cause a "can't find file" error.
God blessing me...
|
|
|
|
|
I have DataAdapter and DataSet,my dataadapter string is something like this:
"SELECT * FROM TABLE",and I fill dataset with this dataadapter,and I bound Datgrid to it and it's ok.
Now after this I want to set a filter for the recorsets that datagrid show.Can I use those dataadapter and dataset and set the filter in the way that I don't know it,
or I HAVE TO fill dataadapter and dataset from the beginning with new SQL statement?
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
To filter your table:
1) Get the DataView from the appropiate table.
MyTable.DefaultView //this is a property of the table.
2) Set the Filter.
MyTable.DefaultView.RowFilter = "Name = 'Mazdak'";
Andres Manggini.
Buenos Aires - Argentina.
|
|
|
|
|
Thanks
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
I used this code :
string str="CompanyName LIKE '%"+DropDownList1.SelectedItem.Text+"'";
ds.Tables["Customers"].DefaultView.RowFilter=str;
DataGrid1.DataSource=ds;
DataGrid1.DataBind();
I have a drop down list box,it's item form A to Z,when user choose one,data grid must filter by the words that their first character are like that.when I use this code nothing
happen,did I miss something?
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
According to the code above you are matching results where the last letter is the one selected :-P
string str="CompanyName LIKE '"+DropDownList1.SelectedItem.Text+"%'"; is the correct version
Hopefully that is what is causing the problem, because according to the docs what you have should work.
James
Sonork ID: 100.11138 - Hasaki
"Smile your little smile, take some tea with me awhile.
And every day we'll turn another page.
Behind our glass we'll sit and look at our ever-open book,
One brown mouse sitting in a cage."
"One Brown Mouse" from Heavy Horses, Jethro Tull 1978
|
|
|
|
|
James T. Johnson wrote:
Hopefully that is what is causing the problem, because according to the docs what you have should work.
No ,that was not the problem.
It seems that datagrid does not update.
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
hmmmm, I'll have to get back with you tomorrow; my brain has shut-down for the night
James
Sonork ID: 100.11138 - Hasaki
"Smile your little smile, take some tea with me awhile.
And every day we'll turn another page.
Behind our glass we'll sit and look at our ever-open book,
One brown mouse sitting in a cage."
"One Brown Mouse" from Heavy Horses, Jethro Tull 1978
|
|
|
|
|
I agree with James on this:
string str="CompanyName LIKE '"+DropDownList1.SelectedItem.Text+"%'"; is the correct version
where do you have that code, in what event ?.
I assume you know if DropDownList changes the filter will not do it automatically.
sorry if this is too obvious.
Andres Manggini.
Buenos Aires - Argentina.
|
|
|
|
|
I need a SQL statement which retreive all strings start with special charachter.
For example all words start with 'M' in recordserts.
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
SELECT X FROM Y WHERE X LIKE 'M%'
Omer.
|
|
|
|
|
Thanks
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
Here is the sql stmt
SELECT * FROM <tablename> WHERE Name like 'M%'
Sjt
From Heaven
|
|
|
|
|
Thanks
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
I'm trying to page a recordset, but in one case I have a problem. The code looks like:
<br />
sSQL = "SELECT Table1.*, Table2.* " &_<br />
"FROM Table1 LEFT JOIN Table2 ON Table1.Name = Table2.Name"<br />
rec.CursorLocation = adUseClient<br />
rec.CacheSize = 25<br />
rec.PageSize = 25<br />
rec.Open sSQL, con, adOpenForwardOnly, adLockReadOnly<br />
In case that the Table1.Name exists in Table2.Name, all is working correct. But if not... I'm getting E_FAIL from Microsoft Cursor Engine when I'm trying to do anything with returned Recordset. Though without paging and having a client cursor, it works fine.
Any ideas what is going on and how to fix it?
Philip Patrick
"Two beer or not two beer?" (Shakesbeer)
Web-site: www.saintopatrick.com
|
|
|
|
|
Hi,
When i try to install DAO components (Jet 3.5) on Windows NT WorkStation or Server, the following error message appear:
Another application is currently using JET file, close all applications and continue.
I try to follow the resolution method ( Q169497 ) to resolve this problem but it don't work.
Anybody can help me to solve this problem?
Thanks in advance
Cheickna
|
|
|
|
|
What is sinfully wrong with the below implementation?
I am just doing some simple learning experiments and the below code is 2000 times slower then using MySQL's api. If that kind of difference was typical no one would be using ADO. So I assume it is missing something standard.
CADODatabase MyADO;
CString ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};\
SERVER=localhost;\
PORT=986;\
DATABASE=genealogy;\
USER=user;\
PASSWORD=pass;\
OPTION=4;";
if(MyADO.Open(ConnectionString))
{
Person *MyPer;
long int pnum = Persons.GetSize();
long int newid;
long int i;
CString sql;
for (i=1;i<pnum;i++)
{
MyPer = (Person*)Persons[i];
if(MyPer!=NULL)
{
sql.Format("INSERT INTO ind VALUES (%d,'%s','%s','%s',%s,%s,%d);",
MyPer->id,MyPer->first,MyPer->last,MyPer->sex,NULL,NULL,0);
MyADO.Execute(sql);
}
}
MyADO.Close();
}
Good ideas are not adopted automatically.
They must be driven into practice with courageous patients. -Admiral Rickover. ...
|
|
|
|
|
Hallo,
I write into xls file. I try to create new table but I have problems with few characters in header.
Do you know how to write "[" and "]" character into headr - field name?
And when I need to write upper delta character?
Thanks, Alex.
|
|
|
|
|
Just wondering if anyone can help me. I've written quite a few queries now, but I was wondering if I could do this with a single query;
I have four tables in Access;
tblJobs ( ID, ... )
tblAreas ( ID, ... )
tblSchedule ( ID, JobID, AreaID, ... )
tblJobAreaLink ( JobID, AreaID ) I have a function in the program to delete a job record, and I want to be able to automatically delete all related records in the tables above.
So far I have:
con.Execute "DELETE * FROM tblJobs WHERE ID=" & id
con.Execute "DELETE * FROM tblSchedule WHERE JobID=" & id But I want to be able to delete the areas too - how can I go about this in one statement?
Thanks!
--
Andrew.
|
|
|
|
|
Use the "Relationships" tool to define JobID and AreaID as foreign keys, and set "Cascade Delete Related Records" on the relationships.
|
|
|
|
|
Unfortunately due to the requirements of the program, I can't employ this option. Thanks anyway though!
--
Andrew.
|
|
|
|
|
I want to know how to process a Word document using VBA.Can you tell me where are the information?thank you!
Besides VBA,which tools can do the same work,SQL?C++builder?
If you can find information about this,please tell me.
For i know little English,I hope you can tell me the particular web sites.Thank you very much!
huang chun shen
|
|
|
|
|
I want to know how to process a Word document using VBA.Can you tell me where are the information?thank you!
Besides VBA,which tools can do the same work,SQL?powerbuilder?
If you can find information about this,please tell me.
For i know little English,I hope you can tell me the particular web sites.Thank you very much!
|
|
|
|
|
What's wrong with this code:
OleDbConnection thisConnection=new OleDbConnection(
@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\Inetpub\wwwroot\First\Testing.mdb");
thisConnection.Open();
OleDbDataAdapter thisAdapter = new OleDbDataAdapter(
"SELECT * FROM Table1", thisConnection);
OleDbCommandBuilder thisBuilder = new OleDbCommandBuilder(thisAdapter);
DataSet thisDataSet = new DataSet();
thisAdapter.Fill(thisDataSet, "Table1");
DataRow myRow=thisDataSet.Tables["Table1"].NewRow();
myRow["Column1"]="mazy";
myRow["Column2"]="Hello everybody!";
myRow["Column3"]=312;
thisDataSet.Tables["Table1"].Rows.Add(myRow);
thisAdapter.Update(thisDataSet,"Table1");
thisConnection.Close();
the exeption thrown for this line:
thisAdapter.Update(thisDataSet,"Table1");----------->Operation must use an updateable query.
Any suggestion??
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|