Click here to Skip to main content
15,916,318 members
Home / Discussions / C#
   

C#

 
GeneralRe: Syste.OutOfMemoryException Pin
Member 461797111-Mar-09 15:16
Member 461797111-Mar-09 15:16 
GeneralRe: Syste.OutOfMemoryException [modified] Pin
Luc Pattyn11-Mar-09 15:49
sitebuilderLuc Pattyn11-Mar-09 15:49 
GeneralRe: Syste.OutOfMemoryException Pin
Member 461797111-Mar-09 16:53
Member 461797111-Mar-09 16:53 
GeneralRe: Syste.OutOfMemoryException Pin
Luc Pattyn11-Mar-09 16:10
sitebuilderLuc Pattyn11-Mar-09 16:10 
GeneralRe: Syste.OutOfMemoryException Pin
Member 461797111-Mar-09 16:55
Member 461797111-Mar-09 16:55 
GeneralRe: Syste.OutOfMemoryException Pin
Luc Pattyn11-Mar-09 17:13
sitebuilderLuc Pattyn11-Mar-09 17:13 
GeneralRe: Syste.OutOfMemoryException Pin
Member 461797111-Mar-09 17:48
Member 461797111-Mar-09 17:48 
AnswerRe: Syste.OutOfMemoryException Pin
Ennis Ray Lynch, Jr.11-Mar-09 19:46
Ennis Ray Lynch, Jr.11-Mar-09 19:46 
First, don't mix case in the same scope. Local variables are usually either camelCase, or PascalCase but doing both is very poor practice, most people use camelCase. Watch the types of your objects, calling ToStrings on strings shows a poor thought process. Also, don't update the GUI in your loop (lblPath.Text = path) it can be part of the problem and most likely will not update with any regularity.

I do not know if this will work but you can try the code below: (Fix any of my typing errors as I typed it in this window), I don't know if JET supports prepared parameters but if it does you can call command.Prepare() before the loop begins.

OleDbCommand command = new OleDbCommand();
command.Connection = connection;
command.CommandText = "INSERT INTO library(artist, title, album, path) VALUES (@artist, @title, @album, @path);"
command.Parameters.Add("@artist", OleDbType.VarChar);
command.Parameters.Add("@title", OleDbType.VarChar);
command.Parameters.Add("@album", OleDbType.VarChar);
command.Parameters.Add("@path", OleDbType.VarChar);
string sqlString = ";
foreach(string path in filePaths){
    currentSong = new ID3Info(path, true);  //Is this disposable? If so use using(currentSong = new ID3Info(path, true){
    command.Parameters["@artist"].Value = currentSong.ID3v2Info.GetTextFrame("TPE1");
    command.Parameters["@title"].Value = currentSong.ID3v2Info.GetTextFrame("TIT2");
    command.Parameters["@album"].Value = currentSong.ID3v2Info.GetTextFrame("TALB");
    command.Parameters["@path"].Value = path;
    command.ExecuteNonQuery();
}



Need custom software developed? I do C# development and consulting all over the United States.

A man said to the universe:
"Sir I exist!"
"However," replied the universe,
"The fact has not created in me
A sense of obligation."
--Stephen Crane


QuestionSetting Form2's start position as Form1's last position Pin
Paulo Toureiro11-Mar-09 13:05
Paulo Toureiro11-Mar-09 13:05 
AnswerRe: Setting Form2's start position as Form1's last position Pin
DaveyM6911-Mar-09 13:21
professionalDaveyM6911-Mar-09 13:21 
GeneralRe: Setting Form2's start position as Form1's last position Pin
Paulo Toureiro11-Mar-09 13:40
Paulo Toureiro11-Mar-09 13:40 
GeneralRe: Setting Form2's start position as Form1's last position Pin
Expert Coming11-Mar-09 14:16
Expert Coming11-Mar-09 14:16 
GeneralRe: Setting Form2's start position as Form1's last position Pin
Paulo Toureiro11-Mar-09 14:21
Paulo Toureiro11-Mar-09 14:21 
GeneralRe: Setting Form2's start position as Form1's last position Pin
DaveyM6911-Mar-09 14:31
professionalDaveyM6911-Mar-09 14:31 
GeneralRe: Setting Form2's start position as Form1's last position Pin
Paulo Toureiro11-Mar-09 14:40
Paulo Toureiro11-Mar-09 14:40 
GeneralRe: Setting Form2's start position as Form1's last position Pin
DaveyM6911-Mar-09 14:49
professionalDaveyM6911-Mar-09 14:49 
QuestionUsing Generic Method to Determine if All Elements in an Array is Zero Pin
mfcuser11-Mar-09 12:17
mfcuser11-Mar-09 12:17 
AnswerRe: Using Generic Method to Determine if All Elements in an Array is Zero Pin
Christian Graus11-Mar-09 12:27
protectorChristian Graus11-Mar-09 12:27 
AnswerRe: Using Generic Method to Determine if All Elements in an Array is Zero Pin
Adam Maras11-Mar-09 12:27
Adam Maras11-Mar-09 12:27 
GeneralRe: Using Generic Method to Determine if All Elements in an Array is Zero Pin
mfcuser11-Mar-09 12:47
mfcuser11-Mar-09 12:47 
GeneralRe: Using Generic Method to Determine if All Elements in an Array is Zero Pin
Adam Maras11-Mar-09 13:32
Adam Maras11-Mar-09 13:32 
GeneralRe: Using Generic Method to Determine if All Elements in an Array is Zero Pin
mfcuser12-Mar-09 4:29
mfcuser12-Mar-09 4:29 
GeneralRe: Using Generic Method to Determine if All Elements in an Array is Zero Pin
mfcuser12-Mar-09 5:08
mfcuser12-Mar-09 5:08 
QuestionHiding an empty Column in Gridview Pin
edcorusa11-Mar-09 11:31
edcorusa11-Mar-09 11:31 
AnswerRe: Hiding an empty Column in Gridview Pin
dataminers11-Mar-09 12:10
dataminers11-Mar-09 12:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.