473,324 Members | 2,417 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Modifying / Displaying info from SQL server

Hi all,

I'm a newbie to C# and .NET, so please be gentle! My limited background is
in VBScript,ASP, and Access dbs.

I need to retrieve data from a SQL server db (8.0) to be displayed in a
table format on a web page. I also need to do some major calculations with
the numbers from the DB, and insert them into the table. ie, if (field =
something) then display a row of calculated values.

I've tried using a SqlDataReader, but it seems I can't format the numbers
the way I want them (it grabs the field value as an object and I can only
convert them to strings, but I need them as numbers). Datagrids are only good
with grabbing and displaying, without modifying the info much.

Maybe I'm just missing something with retrieving the fields as numbers using
sqldatareader...

Anyway, what's the best/easiest way to implement what I've described above?

Thanks in advance for any suggestions!
Aug 4 '05 #1
2 1348
The declared type is object in the indexer. But the actual type will be an
integer, if that is what you retrieved from the database. You can cast it to
any object type - no one says it can only be a string.

The datagrid also allows you to define format masks for the fields.
Additionally, you could in theory do all your formatting in the SQL itself,
so all the data is already formatted once you retrieve it.

I suggest you take some time out to look at some sample online of doing all
this. There are plenty of them, you should be able to adapt them to fit your
needs.

"Rose" <Ro**@discussions.microsoft.com> wrote in message
news:A8**********************************@microsof t.com...
Hi all,

I'm a newbie to C# and .NET, so please be gentle! My limited background is
in VBScript,ASP, and Access dbs.

I need to retrieve data from a SQL server db (8.0) to be displayed in a
table format on a web page. I also need to do some major calculations with
the numbers from the DB, and insert them into the table. ie, if (field =
something) then display a row of calculated values.

I've tried using a SqlDataReader, but it seems I can't format the numbers
the way I want them (it grabs the field value as an object and I can only
convert them to strings, but I need them as numbers). Datagrids are only
good
with grabbing and displaying, without modifying the info much.

Maybe I'm just missing something with retrieving the fields as numbers
using
sqldatareader...

Anyway, what's the best/easiest way to implement what I've described
above?

Thanks in advance for any suggestions!

Aug 4 '05 #2
I figured out my problem with converting. I need to do
mySqlDR["fieldname"].GetType() in order to figure out what to cast the obejct
to. (duh)

Thanks for the advice.
Aug 4 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Sp33di3 | last post by:
I've been searching and searching for this and there are lots of posts - but very few answers. I have a SQL2000 Database that has jpg images in a table that I want to display in a webpage. I...
2
by: yvan | last post by:
I was wondering if someone here could help me with modifying this PHP template so that it does something very specific for me. My knowledge of PHP is very limited (I'm more of a Cold Fusion...
2
by: Rose | last post by:
Hi all, I'm a newbie to C# and .NET, so please be gentle! My limited background is in VBScript,ASP, and Access dbs. I need to retrieve data from a SQL server db (8.0) to be displayed in a...
1
by: j7.henry | last post by:
I am trying to pull specific data that is in a comma delimited file into a web page. So if my comma delimited file looks like: Name,Address,Zip Fred,123 Elm,66666 Mike,23 Jump,11111 I would...
20
by: Tim Reynolds | last post by:
Team, I am developing a web service. In testing in on my enw PC, I am expecting to see exceptions thrown appear on my browser. Instead I am getting an HTTP 500 Internal Server Error page and I am...
1
by: VMI | last post by:
I'm working on an ecommerce-type we app, and I would like to save/retrieve image information into my sql server DB. If I save the file path in my table, how can I use that info to display the...
3
by: Objectifnet | last post by:
Helo, please is there anyone who can help out with this; I have a script that displays details from a MYSQL database and a File Server containing images. Here is the code below: My problem is:...
3
by: GeekyChicky79 | last post by:
Hi Everyone, I have the project below where I'm pulling out information from 1 table "Subjects", pulling the Subjects, and SubjectCode. The Subjects are displaying in the Combo Box just fine,...
5
by: IUnknown | last post by:
Ok, we are all aware of the situation where modifying the folder structure (adding files, folders, deleting files, etc) will result in ASP.NET triggering a recompilation/restart of the application....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.