Click here to Skip to main content
15,891,136 members
Home / Discussions / C#
   

C#

 
GeneralRe: Exception....PLSSSS HELPPPP Pin
Christian Graus2-Oct-09 23:57
protectorChristian Graus2-Oct-09 23:57 
GeneralRe: Exception....PLSSSS HELPPPP Pin
Richard MacCutchan2-Oct-09 23:27
mveRichard MacCutchan2-Oct-09 23:27 
GeneralRe: Exception....PLSSSS HELPPPP Pin
Christian Graus2-Oct-09 23:43
protectorChristian Graus2-Oct-09 23:43 
QuestionException in C# Pin
linto_112-Oct-09 22:11
linto_112-Oct-09 22:11 
AnswerRe: Exception in C# Pin
nagendrathecoder2-Oct-09 22:30
nagendrathecoder2-Oct-09 22:30 
GeneralRe: Exception in C# Pin
linto_112-Oct-09 22:43
linto_112-Oct-09 22:43 
GeneralRe: Exception in C# Pin
Christian Graus2-Oct-09 22:54
protectorChristian Graus2-Oct-09 22:54 
AnswerRe: Exception in C# Pin
nagendrathecoder2-Oct-09 22:55
nagendrathecoder2-Oct-09 22:55 
Try to do it like this:
int rnd;
int totalcount = 0;
Random SelectRandom = new Random();
OleDbConnection access = new OleDbConnection();
OleDbCommand accesscmd = new OleDbCommand();
OleDbDataReader reader;
if (combo_Category.Text == "Book")
{
string connectionstring = "Provider = Microsoft.Jet.OLEDB.4.0;
Data Source = |DataDirectory|\\HangmanDatabase.mdb";
access.ConnectionString = connectionstring;
access.Open();
accesscmd.CommandText = "Select * From Book";
accesscmd.Connection = access;
reader = accesscmd.ExecuteReader();
while (reader.Read())
{
totalcount = totalcount + 1;
rnd = SelectRandom.Next(0,totalcount - 1);
book = reader.GetValue(0).ToString();
datastring = book.ToCharArray();
}
reader.Close();
access.Close();
convert();
}


I have doubts on following line:
datastring = book.ToCharArray();
R u sure, this line work?

Also, what are you doing if reader is empty?
GeneralRe: Exception in C# Pin
Christian Graus2-Oct-09 23:00
protectorChristian Graus2-Oct-09 23:00 
GeneralRe: Exception in C# Pin
nagendrathecoder2-Oct-09 23:08
nagendrathecoder2-Oct-09 23:08 
GeneralRe: Exception in C# Pin
linto_112-Oct-09 23:10
linto_112-Oct-09 23:10 
GeneralRe: Exception in C# Pin
Christian Graus2-Oct-09 23:12
protectorChristian Graus2-Oct-09 23:12 
QuestionNamed Pipe Implementation Pin
AndyASPVB2-Oct-09 22:02
AndyASPVB2-Oct-09 22:02 
AnswerRe: Named Pipe Implementation Pin
geo_m6-Oct-09 3:53
geo_m6-Oct-09 3:53 
Questionserver/client help Pin
amaankhan2-Oct-09 20:52
amaankhan2-Oct-09 20:52 
AnswerRe: server/client help Pin
Xmen Real 2-Oct-09 21:02
professional Xmen Real 2-Oct-09 21:02 
GeneralRe: server/client help Pin
amaankhan2-Oct-09 21:14
amaankhan2-Oct-09 21:14 
AnswerRe: server/client help Pin
srikrishnakrishna murthy3-Oct-09 0:02
srikrishnakrishna murthy3-Oct-09 0:02 
GeneralRe: server/client help Pin
amaankhan3-Oct-09 4:34
amaankhan3-Oct-09 4:34 
QuestionStop app from stealing Focus Pin
discreetz2-Oct-09 15:37
discreetz2-Oct-09 15:37 
AnswerRe: Stop app from stealing Focus Pin
Christian Graus2-Oct-09 15:40
protectorChristian Graus2-Oct-09 15:40 
QuestionASCII byte array to float Pin
akhanal2-Oct-09 11:44
akhanal2-Oct-09 11:44 
AnswerRe: ASCII byte array to float Pin
Abhishek Sur2-Oct-09 12:02
professionalAbhishek Sur2-Oct-09 12:02 
GeneralRe: ASCII byte array to float Pin
akhanal2-Oct-09 12:07
akhanal2-Oct-09 12:07 
GeneralRe: ASCII byte array to float Pin
Abhishek Sur2-Oct-09 13:10
professionalAbhishek Sur2-Oct-09 13: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.