Click here to Skip to main content
15,920,053 members
Home / Discussions / Database
   

Database

 
GeneralRe: "Select top" command Pin
Bruce Duncan13-Feb-04 6:49
Bruce Duncan13-Feb-04 6:49 
GeneralRe: "Select top" command Pin
dlhson213-Feb-04 17:01
dlhson213-Feb-04 17:01 
GeneralRe: "Select top" command Pin
Hesham Amin13-Feb-04 23:03
Hesham Amin13-Feb-04 23:03 
QuestionCan I execute a DTS package from T-SQL? Pin
Thesisus12-Feb-04 5:24
Thesisus12-Feb-04 5:24 
AnswerRe: Can I execute a DTS package from T-SQL? Pin
Jeff Martin12-Feb-04 10:50
Jeff Martin12-Feb-04 10:50 
Generalgrant permission to access the Msysobjects Pin
Daminda12-Feb-04 2:53
Daminda12-Feb-04 2:53 
GeneralRe: grant permission to access the Msysobjects Pin
Mazdak12-Feb-04 3:30
Mazdak12-Feb-04 3:30 
GeneralData out of large File into MS Access DB Pin
93Current12-Feb-04 2:50
93Current12-Feb-04 2:50 
Hi,

I have no idea anymore...

there is a file named 'fdax.txt' and a MS Access DB with an existing table 'data_table'. I have created a void 'ReadWriteData()' that should read out the data from the file which contains maybe hundreds of lines and insert them into the 'data_table'. My StreamReader works right, the SQL-Syntax is ok. but not more than 30 lines of data will be inserted into 'data_table' before there comes up an OleDbException: Overflow. After clicking OK it will be continued and some lines will be inserted. Then a new OleDbException: Overflow... OK... some lines... Overflow... OK... some lines till the end of loop.

Can anyone help me?

Here is the code of my 'ReadWriteData()':

private void ReadWriteData()<br />
{<br />
	StreamReader datei;<br />
	datei = new StreamReader("fdax.txt", Encoding.ASCII, true,1);<br />
<br />
	string zeile;<br />
	string[] felder;<br />
<br />
	int id = 1;<br />
	while (datei.Peek() != -1)<br />
	{<br />
		zeile = datei.ReadLine();<br />
		felder = zeile.Split(new char[] {','});<br />
<br />
		string datumzeit = felder[1] + felder[2];<br />
		string strOpen = felder[3];<br />
		string strHigh = felder[4];<br />
		string strLow = felder[5];<br />
		string strClose = felder[6];<br />
		string strVolume = felder[7];<br />
<br />
		string strJahr = datumzeit.Substring(0, 4);<br />
		int jahr = Convert.ToInt16(strJahr);<br />
		string strMonat = datumzeit.Substring(4, 2);<br />
		int monat = Convert.ToInt16(strMonat);<br />
		string strTag = datumzeit.Substring(6, 2);<br />
		int tag = Convert.ToInt16(strTag);<br />
		string strStunde= datumzeit.Substring(8, 2);<br />
		int stunde = Convert.ToInt16(strStunde);<br />
		string strMinute= datumzeit.Substring(8, 2);<br />
		int minute = Convert.ToInt16(strMinute);<br />
		string strSekunde= datumzeit.Substring(8, 2);<br />
		int sekunde = Convert.ToInt16(strSekunde);<br />
		convertdatumzeit = new DateTime(jahr, monat, tag, stunde, minute, sekunde, 0);<br />
		string strDatum = Convert.ToString(convertdatumzeit);<br />
		string strId = Convert.ToString(id);<br />
<br />
		string strInsertIntoMDB = "insert into data_table(id, datum, [open], high, low, [close], volume) values(";<br />
			strInsertIntoMDB += ToSQL(strId) + ", '";<br />
			strInsertIntoMDB += ToSQL(strDatum) + "', ";<br />
			strInsertIntoMDB += ToSQL(strOpen) + ", "; <br />
			strInsertIntoMDB += ToSQL(strHigh) + ", "; <br />
			strInsertIntoMDB += ToSQL(strLow)+ ", "; <br />
			strInsertIntoMDB += ToSQL(strClose) + ", "; <br />
			strInsertIntoMDB += ToSQL(strVolume) + ")";<br />
		oleDbCommand1 = oleDbConnection1.CreateCommand();<br />
		oleDbCommand1.CommandText = strInsertIntoMDB;<br />
		try<br />
		{<br />
			oleDbConnection1.Open();<br />
			oleDbCommand1.ExecuteNonQuery();<br />
			oleDbCommand1.Dispose();<br />
			oleDbConnection1.Close();<br />
		}<br />
		catch(Exception ed)<br />
		{<br />
			MessageBox.Show("Error in inserting! "+ed.ToString(), "Error");<br />
		}<br />
		id++;<br />
	}			<br />
		<br />
}<br />
<br />
private string ToSQL( string input )<br />
{<br />
	return input.Replace( "'" , "''" ); <br />
}

GeneralRe: Data out of large File into MS Access DB Pin
Bill Dean13-Feb-04 3:18
Bill Dean13-Feb-04 3:18 
GeneralRe: Data out of large File into MS Access DB Pin
93Current13-Feb-04 8:24
93Current13-Feb-04 8:24 
GeneralStoring RichText data in SQL Database Field Pin
bjulien11-Feb-04 15:54
bjulien11-Feb-04 15:54 
GeneralRe: Storing RichText data in SQL Database Field Pin
basementman13-Feb-04 6:01
basementman13-Feb-04 6:01 
GeneralTable Names Of a MS Access Database Pin
Daminda11-Feb-04 1:04
Daminda11-Feb-04 1:04 
GeneralRe: Table Names Of a MS Access Database Pin
Ian Darling11-Feb-04 2:18
Ian Darling11-Feb-04 2:18 
GeneralRe: Table Names Of a MS Access Database Pin
Thea Burger12-Feb-04 4:01
Thea Burger12-Feb-04 4:01 
GeneralRe: Table Names Of a MS Access Database Pin
FASTian17-Mar-04 20:11
FASTian17-Mar-04 20:11 
GeneralRe: Table Names Of a MS Access Database Pin
Thea Burger18-Mar-04 19:49
Thea Burger18-Mar-04 19:49 
GeneralStored procedure question Pin
LasVegasGuy10-Feb-04 8:20
LasVegasGuy10-Feb-04 8:20 
GeneralRe: Stored procedure question Pin
Bill Dean10-Feb-04 9:26
Bill Dean10-Feb-04 9:26 
GeneralRe: Stored procedure question Pin
Mazdak10-Feb-04 9:28
Mazdak10-Feb-04 9:28 
GeneralRe: Stored procedure question Pin
Husein12-Feb-04 5:45
Husein12-Feb-04 5:45 
GeneralBrick Wall!! Pin
Kwai Cheng Kane10-Feb-04 6:04
Kwai Cheng Kane10-Feb-04 6:04 
GeneralRe: Brick Wall!! Pin
Bill Dean10-Feb-04 8:09
Bill Dean10-Feb-04 8:09 
GeneralRe: Brick Wall!! Pin
Bill Dean10-Feb-04 8:12
Bill Dean10-Feb-04 8:12 
GeneralRe: Brick Wall!! Pin
10-Feb-04 10:13
suss10-Feb-04 10:13 

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.