By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,595 Members | 3,721 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,595 IT Pros & Developers. It's quick & easy.

Reading data from database

P: 1
Hello everyone, I need help with reading data from database. I am working with Visual C++ and MS SQL 2005.
This is the problem:
I have tried to read some values from data base (on a way described below) and it worked when type of data is char, but when they are float it throws error. I know that I should do something with type of data but I donít know how?
Data in base are float, and I need to read it and write it in textBox, not important in which format.
Every advice will be helpful, because it should be working till Monday.
Thanks in advance and best regards M_Boris.

here is part of my code:

try{
if(radioButton1->Checked==true){
cmd->CommandText="SELECT * FROM Razred_5 WHERE "+"Rb_Ucenika='"+arg1+"'";
cmd->CommandType=CommandType::Text;
cmd->Connection=conn;
conn->Open();
SqlDataReader ^rd;
rd=cmd->ExecuteReader();
while(rd->Read()==true){
textBox8->Text::set(rd->GetString(1));
textBox9->Text::set(rd->GetString(2));
textBox13->Text::set(rd->GetString(3));
}
rd->Close();
conn->Close();
delete rd,arg;
}else{...}
Edit/Delete Message
Dec 16 '06 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.