|
Hi everyone,
I've a quest for you.
I have to read data from a DBF file using Microsoft Jet 4.0.
Connection and data reading are OK up to about 1045 times. From that moment,
the driver send always an exception with the message:
"System resource exceeded"
I've tried to switch to a ODBC driver (through DSN) but the problem still remains.
My machine has a WinXP SP2 installed, with SQLServer 2000 SP4.
If someone has a tip...
Thanks,
Vilmer
|
|
|
|
|
check this link
http://www.codeguru.com/forum/archive/index.php/t-24213-p-2.html
|
|
|
|
|
I found nothing about my problem in that page.
I'll try to be more explicit.
Here's a sample of my test code:
Private Shared WithEvents mtmr_Timer As Timers.Timer
Private Shared mstrPath As String
Private Shared mstrFile As String
Private Sub btnStart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStart.Click
If mtmr_Timer Is Nothing Then
mtmr_Timer = New Timers.Timer
End If
AddHandler mtmr_Timer.Elapsed, AddressOf CheckVariable
mtmr_Timer.Interval = 500
mtmr_Timer.Start()
End Sub
Private Shared Sub CheckVariable(ByVal source As Object, ByVal e As ElapsedEventArgs)
Dim objConn As Connection
Dim objRS As Recordset
Try
objConn = New Connection
objConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & mstrPath & ";" & _
"Extended Properties=""DBASE IV;"";"
objConn.Open()
objRS = New Recordset
objRS = objConn.Execute("SELECT top 20 * FROM " & mstrFile & " ORDER BY 1")
If Not (objRS.EOF And objRS.BOF) Then
objRS.MoveFirst()
While Not objRS.EOF
objRS.MoveNext()
End While
End If
Catch ex As Exception
mtmr_Timer.Stop()
MsgBox(ex.Message, MsgBoxStyle.Critical + MsgBoxStyle.OKOnly)
Finally
If Not (objRS Is Nothing) Then
objRS.Close()
objRS = Nothing
End If
If Not (objConn Is Nothing) Then
If objConn.State = ConnectionState.Open Then
objConn.Close()
End If
objConn.Dispose()
End If
GC.Collect()
End Try
End Sub
|
|
|
|
|
Why are you using the old (COM) ADO classes inside of .Net code?
Souldn't you be using System.Data.Oledb classes instead?
First, neither Connection nor RS are garbage collected objects, so I presume you are using some kind of wrapper around the MSADO dll. Calling GC.collect (always a bad idea unless you are absolutely certain you must) probably creates the leak, since it is likely that the wrapped com objects don't get released at the right time... (you close the RS object, but don't dispose...and since it is nulled, GC likely collects it...
Mixing COM and .Net is not a good thing, and in this case you really don't need to, since .Net classes with even better functionallity exist.
Absolute faith corrupts as absolutely as absolute power
Eric Hoffer
All that is necessary for the triumph of evil is that good men do nothing.
Edmund Burke
|
|
|
|
|
I use COM inside .NET because I am just testing ADO with dBase IV files. This sample code is just a test application.
The main application where the performance of ADO is critical is written in VBA, so I have to use standard COM objects.
During my tests, I have discovered an abnormal behaviour of my test application:
I have several standard machines (WinXP SP2, MDAC 2.8, etc...) and in one of them it works properly. It's quite strange because in that one, the driver doesn't accept file names longer than 8 chars (defined as DOS 8.3 standard names). I've checked all drivers version and it seems they are the same in every machine.
Does anyone know which package (or settings) could make this possible?
|
|
|
|
|
Hello,
I have a task to write a tool that converts the structure of a sybase database to postgre database. What are the steps I need to follow to do such converter tool? Please help with ideas and examples if possible !
Thanks
|
|
|
|
|
I remember a few years ago using a script to generate a CREATE TABLE statement. You would simply pass the table name and it would generate the statement using the required system tables: sysobjects, syscolumns, etc... Search on Google as I used in sysbase. From there you will have to modify script for postgre which I am not familiar with.
Michael
I firmly believe that any man's finest hour, the greatest fulfillment of all that he holds dear, is that moment when he has worked his heart out in a good cause and lies exhausted on the field of battle - victorious.
Vince Lombardi (1913-1970)
|
|
|
|
|
Hallo,
I use the following VC++ Code with ADO to retrieve the column name of a given table. When I look in the debugger at the order of the columns I receive, it is different from the order in my table. How is it possible?
Does anybody has an idea how I can get my columns in the order they are in my table?
ADOX::Tables *pTables;
ADOX::_TablePtr pTable;
HRESULT hr = m_pCat->get_Tables(&pTables);
if (SUCCEEDED(hr)) {
int nTablesCount = pTables->GetCount(),
nInd = 0;
// Tabelle suchen.
pTable = pTables->GetItem(COleVariant(sKategorie));
//
ADOX::Columns *pColumns;
ADOX::_ColumnPtr pColumn;
pTable->get_Columns(&pColumns);
lColumnCount = pColumns->GetCount();
// Alle Spalten abarbeiten.
for (long lColumn = 0; lColumn < lColumnCount; lColumn++) {
pColumn = pColumns->GetItem(COleVariant((long)lColumn));
_bsColumnName = pColumn->GetName();
bsColumnName = _bsColumnName.GetBSTR();
Thanks in advance.
Patrick
|
|
|
|
|
a select have no order to return the records, until you tell it to with an order by statement... it may be the same here...
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20][VisualCalc 3.0]
|
|
|
|
|
Hi all,
I have a situation where I have a table in my SQL Server 2000 database, and another table stored as a .csv file. I would like to perform a join on the two tables. Is it possible to do this without entering the data in the .csv table into the SQL Server database?
I am using C#.NET for this stuff.
Cheers,
Michael
|
|
|
|
|
I haven't tried this for a text file, but give the Link Server a try in the enterprise manager. If I remember correctly the syntax is as follows: select * from linkserver...tablename.
Michael
I firmly believe that any man's finest hour, the greatest fulfillment of all that he holds dear, is that moment when he has worked his heart out in a good cause and lies exhausted on the field of battle - victorious.
Vince Lombardi (1913-1970)
|
|
|
|
|
Hi,
Where can I find the pros and cons of migrating from MS-SQL Server 2000 to MS-SQL Server 2005.
I was actually looking at the microsoft site, but was not able to find the exact one. May be I didn't go to the right page.
Thanks,
|
|
|
|
|
Check this link
http://www.databasejournal.com/features/mssql/article.php/3564291
|
|
|
|
|
|
Hi,
Im using classic asp with an MS SQL server.
I have a table hosting a number of contact for a number of different users.
How do i go about deleting duplicate records in the table for a given user?
Obviously i need to keep 1 copy of every contact, and simply remove any additional records that might exist for this contact.
Any help would be greatly appreciated.
Thanks!!!!!!!!!!!!!
|
|
|
|
|
Hi there,
Not sure exactly it's true or not. Should do a backup one first ...
- select distinct rows from table1 and copy into table1
- delete table1
- insert back rows from table2 to table1
<< >>
|
|
|
|
|
enjoycrack wrote: Not sure exactly it's true or not. Should do a backup one first ...
- select distinct rows from table1 and copy into table1
- delete table1
- insert back rows from table2 to table1
Hi
not sure that would work. As each contact has unique ID yet several users might have a contact that is on someone elses contact list also.
Needs a more robust solution.
Thanks anyway.
|
|
|
|
|
Hi there,
So basing on what to consider that 2 records are duplicated?
<< >>
|
|
|
|
|
If one user has two contacts records the same eg:
where the AccountHolderID, FirstName, and Email are the same for two or more records.
|
|
|
|
|
just do what I suggest... what things do you worry about???
IMO, this can be done with sql script described above....
And remember to do back up first.
Gud luke
<< >>
|
|
|
|
|
here is ur solution
http://support.microsoft.com/default.aspx?scid=kb;en-us;139444
|
|
|
|
|
Thanks!
Didnt think it would be so complicated!!!
|
|
|
|
|
Hello, i'm novice with Visual C# and SQL Server, so can someone help me please ... i want search for a record in the database, and if it is found then i move the CurrencyManager position to its position but i got this error:
ConstraintException was unhandled:
Column 'cd_id' is constrained to be unique. Value '9463216602' is already present.
in my database this field [cd_id] in both tables aren't the primary key, are just simple fields ... what's i'm doing wrong, can someone help me please, i'm using this code:
the general variables:
<br />
SqlConnection myConnection;<br />
SqlDataAdapter daCD, daTemas;<br />
DataSet myDataSet = new DataSet("MusicaTeca");<br />
DataViewManager myDVM;<br />
CurrencyManager cm;<br />
in the form_load:
<br />
private void frmProduto_Load(object sender, EventArgs e)<br />
{<br />
myConnection = new SqlConnection(<br />
"Server=(local)\\SQLEXPRESS;DataBase=musicateca;" +<br />
"integrated Security=SSPI");<br />
<br />
daCD = new SqlDataAdapter("SELECT * FROM tbl_cds", myConnection);<br />
daCD.TableMappings.Add("Table", "tbl_scds");<br />
daCD.Fill(myDataSet, "tbl_cds");<br />
<br />
daTemas = new SqlDataAdapter("SELECT * FROM tbl_temas", myConnection);<br />
daTemas.TableMappings.Add("Table", "tbl_temas");<br />
daTemas.Fill(myDataSet, "tbl_temas");<br />
<br />
myDVM = myDataSet.DefaultViewManager;<br />
<br />
DataRelation relCD_Tema;<br />
DataColumn parentCol, childCol;<br />
parentCol = myDataSet.Tables["tbl_cds"].Columns["cd_id"];<br />
childCol = myDataSet.Tables["tbl_temas"].Columns["cd_id"];<br />
relCD_Tema = new DataRelation("RelCD_Temas", parentCol, childCol);<br />
myDataSet.Relations.Add(relCD_Tema);<br />
<br />
txtAlbum.DataBindings.Add("Text", myDVM, "tbl_cds.album");<br />
txtAno.DataBindings.Add("Text", myDVM, "tbl_cds.ano");<br />
txtArtista.DataBindings.Add("Text", myDVM, "tbl_cds.artista");<br />
txtEditora.DataBindings.Add("Text", myDVM, "tbl_cds.editora");<br />
txtGenero.DataBindings.Add("Text", myDVM, "tbl_cds.genero");<br />
txtID.DataBindings.Add("Text", myDVM, "tbl_cds.cd_id");<br />
<br />
dbGrid.DataSource = myDVM;<br />
dbGrid.DataMember = "tbl_cds.RelCD_Temas";<br />
dbGrid.Columns["reg_id"].Visible = false;<br />
dbGrid.Columns["cd_id"].Visible = false;<br />
<br />
cm = (CurrencyManager)this.BindingContext[myDVM, "tbl_cds"];<br />
}<br />
and the search button_click:
<br />
private void btnLocalizar_Click(object sender, EventArgs e)<br />
{<br />
int intRow;<br />
<br />
myDVM.DataViewSettings["tbl_cds"].Sort = "cd_id";<br />
intRow = myDataSet.Tables["tbl_cds"].DefaultView.Find(txtID.Text);<br />
<br />
if (intRow > 0)<br />
{<br />
cm.Position = intRow;
cm.Refresh();<br />
}<br />
else<br />
{<br />
MessageBox.Show("Registo não localizado!");<br />
}<br />
}<br />
can someone help me please ... and forgive me my bad english.
Thanks
UltraMAX
|
|
|
|
|
A field need not be a primary key to have a unique constraint. Sounds like cd_id has a unique constraint or index defined for it. Check the db definitions.
Absolute faith corrupts as absolutely as absolute power
Eric Hoffer
All that is necessary for the triumph of evil is that good men do nothing.
Edmund Burke
|
|
|
|
|
i think you have set up the relation between the two tables in the dataset memory, hence your parent table which contains is taken as the primary key.
Please check out this.
|
|
|
|