Click here to Skip to main content
15,900,816 members
Home / Discussions / C#
   

C#

 
GeneralRe: how to use progressbar for copying file ? Pin
Christian Graus20-Oct-06 8:10
protectorChristian Graus20-Oct-06 8:10 
GeneralRe: how to use progressbar for copying file ? Pin
Vega0220-Oct-06 8:11
Vega0220-Oct-06 8:11 
QuestionHelp Pin
jluis_hdezg20-Oct-06 6:08
jluis_hdezg20-Oct-06 6:08 
AnswerRe: Help Pin
Vega0220-Oct-06 7:00
Vega0220-Oct-06 7:00 
QuestionUSB HID POS Pin
Kenny O'Dell20-Oct-06 6:03
Kenny O'Dell20-Oct-06 6:03 
AnswerRe: USB HID POS Pin
eggie520-Oct-06 21:16
eggie520-Oct-06 21:16 
GeneralRe: USB HID POS Pin
Kenny O'Dell23-Oct-06 5:59
Kenny O'Dell23-Oct-06 5:59 
Questionfoxpro general field type and c# byte[] Pin
mcgahanfl20-Oct-06 5:56
mcgahanfl20-Oct-06 5:56 
//The problem is that bytes written to a FoxPro General Field are not being read back in correctly.
//This code will write 10 bytes to a general field and then read them back in. When the data is read back it will be incorrect.

//Part 1 of 2. Write a byte[] with values 0..9 to a foxpro 'General Field'
OleDbConnection oleDbConnection = new OleDbConnection(@"Provider=VFPOLEDB.1;Data Source=c:\blobTest\");
oleDbConnection.Open();

byte[] adtByte = new byte[10];
for(Int16 i = 0; i < 10; i++)//load the array with values 0,1,2,3,4,5,6,7,8,9
adtByte[i] = (byte)i;

OleDbCommand command = oleDbConnection.CreateCommand();
command.CommandText = "DELETE FROM image"; //clean up past attempts
command.ExecuteNonQuery();
command.CommandText = "INSERT INTO image (image_len, image_val) VALUES (?, ?)";
//foxpro table 'image' has two fields. image_len of type interger and image_val of type general.

OleDbParameter p1 = new OleDbParameter("?", OleDbType.Integer);
p1.Value = adtByte.Length;
command.Parameters.Add(p1);

OleDbParameter p2 = new OleDbParameter("?", OleDbType.Binary);
p2.Value = adtByte; //write the byte array as type binary - I think this is my problem????
command.Parameters.Add(p2);

command.ExecuteNonQuery();
command.Dispose();
//At this point we should have one row in the table and the values should be;
// image_len = 10
// image_value = 0123456789
//--------------------------------------------------------------

//Part 2 of 2. Read the row just created back into a pair of variables.
OleDbCommand oleDbCommand = new OleDbCommand("Select * from image", oleDbConnection);
OleDbDataReader oleDbReader = oleDbCommand.ExecuteReader();
while (oleDbReader.Read())
{
object objFieldImage = oleDbReader["image_val"];
byte[] inBytes = (byte[])objFieldImage;
object objFieldLen = oleDbReader["image_len"];
int iLen = Convert.ToInt32(objFieldLen);
//At this point image_len is 10 as expected.
//but inBytes has doubled in size and the value is all wrong.

}


thanksSniff | :^)
QuestionSplitContainer Pin
alpha_1020-Oct-06 5:54
alpha_1020-Oct-06 5:54 
AnswerRe: SplitContainer Pin
salysle20-Oct-06 17:07
salysle20-Oct-06 17:07 
QuestionRe: SplitContainer [modified] Pin
alpha_1022-Oct-06 21:24
alpha_1022-Oct-06 21:24 
AnswerRe: SplitContainer Pin
salysle23-Oct-06 15:50
salysle23-Oct-06 15:50 
QuestionFormat a long value to a date time value Pin
jluis_hdezg20-Oct-06 5:42
jluis_hdezg20-Oct-06 5:42 
AnswerRe: Format a long value to a date time value Pin
Dustin Metzgar20-Oct-06 6:41
Dustin Metzgar20-Oct-06 6:41 
AnswerRe: Format a long value to a date time value Pin
Larantz20-Oct-06 13:42
Larantz20-Oct-06 13:42 
QuestionDifference between two time span in C# Pin
onlybabla20-Oct-06 5:13
onlybabla20-Oct-06 5:13 
AnswerRe: Difference between two time span in C# Pin
Dustin Metzgar20-Oct-06 6:49
Dustin Metzgar20-Oct-06 6:49 
Questionpassing XML from embedded webbrowser to C# Pin
jarlath20-Oct-06 5:02
jarlath20-Oct-06 5:02 
Questionhow to develop web based vs desktop application Pin
yasminnnnn20-Oct-06 4:44
yasminnnnn20-Oct-06 4:44 
AnswerRe: how to develop web based vs desktop application Pin
Judah Gabriel Himango20-Oct-06 4:56
sponsorJudah Gabriel Himango20-Oct-06 4:56 
GeneralRe: how to develop web based vs desktop application Pin
yasminnnnn20-Oct-06 10:51
yasminnnnn20-Oct-06 10:51 
GeneralRe: how to develop web based vs desktop application Pin
Judah Gabriel Himango22-Oct-06 9:10
sponsorJudah Gabriel Himango22-Oct-06 9:10 
QuestionWEB CONFIG Question - Please Help Pin
iamnew2C#20-Oct-06 4:32
iamnew2C#20-Oct-06 4:32 
AnswerRe: WEB CONFIG Question - Please Help Pin
Elina Blank20-Oct-06 9:07
sitebuilderElina Blank20-Oct-06 9:07 
QuestionCreating Toolbars in C# Pin
clife53720-Oct-06 4:08
clife53720-Oct-06 4:08 

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.