Click here to Skip to main content
15,909,466 members
Home / Discussions / C#
   

C#

 
QuestionSender as form access class propertys Pin
Member 69748219-Mar-10 12:29
Member 69748219-Mar-10 12:29 
AnswerRe: Sender as form access class propertys [modified] Pin
Luc Pattyn9-Mar-10 12:36
sitebuilderLuc Pattyn9-Mar-10 12:36 
GeneralRe: Sender as form access class propertys Pin
Member 69748219-Mar-10 12:46
Member 69748219-Mar-10 12:46 
GeneralRe: Sender as form access class propertys [modified] Pin
Luc Pattyn9-Mar-10 12:54
sitebuilderLuc Pattyn9-Mar-10 12:54 
QuestionTelerik RadGred Question Pin
Kevin Marois9-Mar-10 11:16
professionalKevin Marois9-Mar-10 11:16 
QuestionC# and MySQL Pin
Evgeni579-Mar-10 10:21
Evgeni579-Mar-10 10:21 
AnswerRe: C# and MySQL Pin
Luc Pattyn9-Mar-10 10:40
sitebuilderLuc Pattyn9-Mar-10 10:40 
GeneralRe: C# and MySQL Pin
Evgeni579-Mar-10 21:01
Evgeni579-Mar-10 21:01 
Well, I tried it but it didn't work.
Here is a part of my code, can you tell me, please, what I did wrong?
MySqlConnection connection = new MySqlConnection(MyConString);
MySqlCommand command = connection.CreateCommand();
try
{
    connection.Open();
    Console.WriteLine("Connected to DB");
}
catch (Exception e)
{
    Console.WriteLine("Failed to connect to DB");
    return;
}
command.CommandText = "truncate table test_tb";
command.ExecuteNonQuery();
connection.Close();


StreamReader sr = new StreamReader("somefile.txt", Encoding.GetEncoding(1251));
string line, query;
string[] data;
byte[] temp = new byte[10000];
int j = 0;
while ((line = sr.ReadLine()) != null && j < 10)
{
    data = line.Split('~');

    query = "insert into test_tb (name, id) values(N'" + data[2] + "'," + j.ToString() + ")";
    /*Some parsing was done here, data[2] contains 1251 encoded string*/
    temp = ASCIIEncoding.GetEncoding(1251).GetBytes(query);
    command.CommandText = ASCIIEncoding.GetEncoding(1251).GetString(temp);
    connection.Open();
    command.ExecuteNonQuery();
    connection.Close();
    ++j;
}


The column in table os varchar(1000) type, with windows-1251 encoding

thanks a lot.
QuestionRemap a COM port programmatically Pin
taralex9-Mar-10 9:01
taralex9-Mar-10 9:01 
AnswerRe: Remap a COM port programmatically Pin
Luc Pattyn9-Mar-10 10:45
sitebuilderLuc Pattyn9-Mar-10 10:45 
GeneralRe: Remap a COM port programmatically Pin
taralex9-Mar-10 11:07
taralex9-Mar-10 11:07 
QuestionEasy question about Custom Controls from a newbie. Pin
Kanetakeo9-Mar-10 8:16
Kanetakeo9-Mar-10 8:16 
AnswerRe: Easy question about Custom Controls from a newbie. Pin
DaveyM699-Mar-10 8:50
professionalDaveyM699-Mar-10 8:50 
GeneralRe: Easy question about Custom Controls from a newbie. Pin
Kanetakeo9-Mar-10 10:32
Kanetakeo9-Mar-10 10:32 
GeneralRe: Easy question about Custom Controls from a newbie. Pin
DaveyM699-Mar-10 13:20
professionalDaveyM699-Mar-10 13:20 
QuestionA new, open source, Outlook panel plugin in C# Pin
François-Denis Gonthier9-Mar-10 7:21
François-Denis Gonthier9-Mar-10 7:21 
AnswerRe: A new, open source, Outlook panel plugin in C# Pin
Wes Aday9-Mar-10 8:53
professionalWes Aday9-Mar-10 8:53 
GeneralRe: A new, open source, Outlook panel plugin in C# Pin
François-Denis Gonthier9-Mar-10 9:04
François-Denis Gonthier9-Mar-10 9:04 
GeneralRe: A new, open source, Outlook panel plugin in C# Pin
Garth J Lancaster9-Mar-10 10:40
professionalGarth J Lancaster9-Mar-10 10:40 
GeneralRe: A new, open source, Outlook panel plugin in C# Pin
François-Denis Gonthier15-Mar-10 5:43
François-Denis Gonthier15-Mar-10 5:43 
Questionwhat is the optimal method for handling time-triggered processing Pin
TimWallace9-Mar-10 6:29
TimWallace9-Mar-10 6:29 
AnswerRe: what is the optimal method for handling time-triggered processing Pin
Not Active9-Mar-10 6:46
mentorNot Active9-Mar-10 6:46 
GeneralRe: what is the optimal method for handling time-triggered processing Pin
TimWallace9-Mar-10 6:55
TimWallace9-Mar-10 6:55 
GeneralRe: what is the optimal method for handling time-triggered processing Pin
Dan Mos9-Mar-10 7:11
Dan Mos9-Mar-10 7:11 
GeneralRe: what is the optimal method for handling time-triggered processing Pin
TimWallace9-Mar-10 7:48
TimWallace9-Mar-10 7:48 

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.