473,395 Members | 1,931 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,395 software developers and data experts.

Load data from sql in Array

Hey guys i need help with loading an value from a SQL database record

Its like this i have a database with a table in it and in all those table are records and i know you can load 1 reccord value from a reccord into an array

and i now its it done a litle bit like this

.......Array[0] so that with this bit af code he loads the first record from the database into the array .......

......Array[1] and like this reccord number 2 i know this is posible in C# i just cant get it to work cud somone pleas post the code with how i can load a reccord value into an array with a number behingd it so he know wich record to put in the array

Tnx for your help
Nov 20 '08 #1
8 2201
r035198x
13,262 8TB
Show us what you tried first.
P.S Also read about a neat trick called data binding. It allows you to achieve all that without breaking any bones.
Nov 20 '08 #2
Curtis Rutland
3,256 Expert 2GB
I'm not sure what your goal is, it was a bit hard to understand...but we have two articles that might help you in using a database:
Nov 20 '08 #3
Il try to explain it again i have a databse in sql like this for example

Firstname Lastname Age

Jan Jansen 44
0 1 2

now i have 3 records with a number on it in sql starts with 0 so it looks like this record 0 is Firstname and so on

now i whanne load the name Jan into an Array someting like this
Expand|Select|Wrap|Line Numbers
  1. txtFirstname.Text = OfferteArray[0];
  2. txtLastname.Text = OfferteArray[1];
  3. txtAge.Text = OfferteArray[2] 
so i whant that the OfferteArray[0] has loaded the value Jan from my database and strored it in the txtbox txtFirstname.Text

Hope you understand me now Tnx for reply
Nov 20 '08 #4
r035198x
13,262 8TB
That OfferteArray again! I'm out of this thread.
Nov 20 '08 #5
Haha Tnx for your help man
Nov 20 '08 #6
r035198x
13,262 8TB
OK. One last time.

What you are trying to do with those arrays all over the place is very Fortranesque.
Better use object oriented programming these days. Simply create a small class that represents your table structure. You then read data row by row creating objects of that class type with the data and store those objects in ONE ArrayList where you can then manipulate them at your own leisure.

P.S Several useful hints have already been given to you for your problem but you seem to be ignoring them and starting off multiple threads for the same problem.

P.P.S Remember that double posting is not allowed in these forums.

P.P.P.S: this is really the last time!
Nov 20 '08 #7
balabaster
797 Expert 512MB
OK. One last time.

What you are trying to do with those arrays all over the place is very Fortranesque.
Better use object oriented programming these days. Simply create a small class that represents your table structure. You then read data row by row creating objects of that class type with the data and store those objects in ONE ArrayList where you can then manipulate them at your own leisure.

P.S Several useful hints have already been given to you for your problem but you seem to be ignoring them and starting off multiple threads for the same problem.

P.P.S Remember that double posting is not allowed in these forums.

P.P.P.S: this is really the last time!
P.P.P.P.S: And he really means it this time...
Nov 20 '08 #8
Just for addition info i am not just reading your posts (i dont ignore your hints)i try to use them in my code if i can but i am not superp in english as i think you see in more of my posts so i somethimes have trouble knowing what evry word means and i am gratful your trying to help me but there were differnt errors on the post i posted before but i whont open a new post ont this bit of code anymore just hope you whanne help me with this new error on the same code

Hey i think i got 1 step farther becase now i get an differnt error and if i leave the txt OfferteArray in the code he will still runn the application but i get an error later on in a method

Dont now if you still whanne try to help but i need to try i cant do it myself XD

the error message i get now is

No overload for method 'GetOfferteGegevens' takes '1' arguments

And yes i first lookd on the internet for solutions but cudent find any useful 1
Weird thing is that the error message is differtn from the code error becase the bleu line is under dbConn

here is the code hope somone is interested enouf to try to help

Expand|Select|Wrap|Line Numbers
  1.         #region Invullen van de tekstvelden uit Database
  2.         public void Vullen_tekstvelden(string[] OfferteArray, bool nieuw)
  3.         {
  4.             localhost1.dbConnection dbConn = new localhost1.dbConnection();
  5.             OfferteArray = dbConn.GetOfferteGegevens(txtNoteID.Text);
  6.             txtNoteID.Text = OfferteArray[0];
  7.             txtBTW.Text = "25";
  8.             txtOfferteNr.Text = OfferteArray[1];
  9.             txtDatum.Text = Functions.DateToNL(OfferteArray[2]);
  10.             txtDebNr.Text = OfferteArray[3];
  11.             txtKlantNaam.Text = OfferteArray[4];
  12.             txtContactpersoon.Text = OfferteArray[5];
  13.             txtOmschrijving.Text = OfferteArray[6];
  14.             txtOrderNr.Text = OfferteArray[7];
error is rule number 5 i think on the dbConn.GetOfferteGegevens lap of code
Nov 24 '08 #9

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

Similar topics

1
by: kk | last post by:
I have 2 issues, please help ! 1st issue : -------------------------------------------------------- Loading Grid ------------ 1) creating new rows in a datatable and adding data a array...
7
by: B. Wood | last post by:
I have a small program (see below) that demonstrates an error I am getting when I build the program on a linux platform. I first initialize an unsigned char array (lines 16). I then initialize...
0
by: Kitchen Bin | last post by:
HELP PLEASE!! The C# Visual Studio IDE is failing to load an inherited form into the IDE from a base form when I add items to an array property of a user control on the base form. That sounds...
17
by: John A Grandy | last post by:
For a Hashtable that is expected to contain no more than 100 DictionaryEntry elements , what is the best load factor ? ( This Hashtable is a encapsulted in a class , an instance of which is...
4
by: dac | last post by:
I am quietly going insane on this project. I've never worked on a project like this one before. All my previous sticky forms were for data entry, not editing. I don't know how to display the form...
3
by: The alMIGHTY N | last post by:
I have an XSL file that works with a typically large XML data set generated dynamically from a database. This data is written to the HTML result as a deep multi-dimensional array that is used by...
3
by: robudo | last post by:
Hello, I need some help to solve the following problem. I wrote some html/javascript code to read data from an XML file: XML file: <places> <place year="2000" name="Amsterdam" /> <place...
2
sumaiya
by: sumaiya | last post by:
I know how to load dynamic images in a movieclip sPhoto.loadMovie('http://localhost/1.jpg'); I have two movieclips "mcMain" and "mcArticle" mcMain ---- mcArticle --- mcPhoto mcPhoto is...
0
by: shaqa | last post by:
I try to do this but i cannot. i creat two layers with actionscript seperated as slideshow need to be,,and i try to put in one rectangle all of my images but cannot put in work,it doesnt load when i...
1
anfetienne
by: anfetienne | last post by:
i have this code below that i made....it loads vars from txt file splits it then puts it into an array....once in an array it the brings the pics in from the array to create thumbnails and a larger...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.