|
sorry, I want to save the data into my table. The dataset contains multiple tables I dont know how to link these tables.
|
|
|
|
|
My table structure is headerid,date,studid,studname,studsubject,studmark
i am working in vb.net.can you please help to save this to my table
<MAIN
<Header>
<ID>94</ID>
<TransactionDate>20/03/2010 16:10</TransactionDate>
</Header>
<STUDENT>
<ID>1076523</ID>
<NAME/>
<PLACE>101</PLACE>
<RESULT>
<SUBJECT>MATHS</SUBJECT>
<MARK>465.9</MARK>
</RESULT>
<RESULT>
<SUBJECT>Secondary</SUBJECT>
<MARK>272.4</MARK>
</RESULT>
</STUDENT>
<STUDENT>
<ID>AP1076524</ID>
<NAME/>
<PLACE>117-09-D000004-00</PLACE>
<RESULT>
<SUBJECT>Principal</SUBJECT>
<MARK>592.0</MARK>
</RESULT>
</STUDENT>
</MAIN>
|
|
|
|
|
I am a .net developer, and have worked on .net 2.0 or .net 3.5 for several years. I need to obtain the MCAD or MCPD for a new project. I will greatly appreciate if fellow members recommend some good books or practice-test materials so I can speed up the process.
Cheers,
-James
|
|
|
|
|
You "need" to obtain certification for the project?
MeasureUp are good practice exams. The Microsoft Press exam prep books are mostly worthless as far as I'm concerned.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
I am writing a dll class to take in health patient information. On the developer side, how do i initialize my structure variables?
'code in the dll
Public Class MyClass
Private someData as ArrayList = New ArrayList
Private Structure PatientData
Public myDate as Date
Public myDouble1 as Double
Public myDouble2 as Double
Public myDouble3 as Double
End Structure
Private Function AddData(ByVal visitdate As Date, ByVal bmi As Double, ByVal height As Double, ByVal weight As Double) As Integer
Dim visit As PatientData
visit.myDate = visitdate
visit.myDouble1 = bmi
visit.myDouble2 = height
visit.myDouble3 = weight
visitData.Add(visit)
End Function
end Class
'How do I populate these variables as the developer?
|
|
|
|
|
It seems like you're already doing it? What is the issue?
Also, please remember to format code you post using the pre tags, ie. code block
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
As it's a structure, they will automatically be initialized to their default values.
DaveIf this helped, please vote & accept answer!
Binging is like googling, it just feels dirtier. (Pete O'Hanlon)
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
|
|
|
|
|
bassmaster_general wrote: am writing a dll class to take in health patient information. On the developer side, how do i initialize my structure variables?
'code in the dll
Public Class MyClass
Private someData as ArrayList = New ArrayList
Private Structure PatientData
Public myDate as Date
Public myDouble1 as Double
Public myDouble2 as Double
Public myDouble3 as Double
End Structure
Private Function AddData(ByVal visitdate As Date, ByVal bmi As Double, ByVal height As Double, ByVal weight As Double) As Integer
Dim visit As PatientData
visit.myDate = visitdate
visit.myDouble1 = bmi
visit.myDouble2 = height
visit.myDouble3 = weight
visitData.Add(visit)
End Function end Class
'How do I populate these variables as the developer?
I don't think I was clear. I created a new class, new namespace etc. and was trying to test the interface from another form. I created an object of myClass and the function AddData was not appearing in "intellisense" as an option.
It is because my AddData function was declared as private in myClass. so the issue is resolved.
on another note, after changing the function from private to public, intellisense was still not displaying the AddData option.
I had to close Visual studio and reopen. Now the AddData option appears in the intellisense menu.
odd, thanks for the replies
|
|
|
|
|
I suggest you read up on access modifiers, such as private .
|
|
|
|
|
A few suggestions:
Generally speaking, classes should be used rather than structures. As reference types, classes use memory more efficiently, which is important if objects are going to be persisted for any length of time.
Putting your data class/structure outside the class will make it accessable to other parts of your code. If you flag it as Friend , it will be available in your module but not be exposed to users of your library.
Using the Property syntax will self-document that a variable is actually a property, allow you to have different scopes for getting and setting the property and do pre- and post-processing when you set the values such as raise events, change control visibility and so on. Even if you do not need this functionality now, there is no harm in building your code to be easily extensible.
You can avoid several problems by using a strongly typed enumerable like List(Of T) rather than generic enumerables like ArrayList . Another advantage is that the enumerable can be exposed as a read-only property, which lets you use its Add method instead of having to write your own.
Note also that MyClass is a keyword in VB.Net.
I would have written something like this:
Friend Class PatientData
Private _myDate As Date
Private _myDouble1 As Double
Private _myDouble2 As Double
Private _myDouble3 As Double
Public Property MyDate() As Date
Get
Return _myDate
End Get
Set(ByVal value As Date)
_myDate = value
End Set
End Property
Public Sub New(ByVal VisitDate As Date, ByVal BMI As Double, _
ByVal Height As Double, ByVal Weight As Double)
_myDate = VisitDate
_myDouble1 = BMI
_myDouble2 = Height
_myDouble3 = Weight
End Sub
End Class
Public Class OtherClass
Private _visitData As List(Of PatientData)
Friend ReadOnly Property VisitData() As List(Of PatientData)
Get
If _visitData Is Nothing Then _visitData = New List(Of PatientData)
Return _visitData
End Get
End Property
End Class
The Friend scope on PatientData means that the class can be used within your project but not outside it. That the properties of PatientData are Public makes no difference, as the more restrictive Friend will hide the whole class. You might want to set the class to Public but code the properties to Friend Set : the class will be available with read-only properties outside of your project but have read and write properties within. You could also flag the constructor with Friend , which will let you use existing instances of PatientData outside of your project but not create new ones.
Now, you can add a new visit to your list like this:
OtherClassInstance.VisitData.Add(New PatientData(visitDate, bmi, height, weight))
|
|
|
|
|
I am working on a program that will access an Access database. I am using VB.net 2003. My program in part will record the landings of commercially caught fish. I have structured the database with species names as the column heading and then the rows would be a record of each delivery. A fisherman could make around 50 deliveries in one year.
I have in excess of thirty species in this table as column headings. When I use the DataGrid object, the default is to present my database as it is created with speices names as columns headings. Is there a way to switch the rows and columns when it is being displayed in the program, so the species names become the row headings and the data are shown to the right as a column of data?
|
|
|
|
|
If you manually populate the DataGridView, you can put things anywhere you like.
As a side comment, are you sure you really want the species as columns? That sounds like an open invitation for problems down the line! I'd consider using some other record layout, like perhaps a species name and a record of delivery on each record. Better yet, normalize it and have a table with species name and an integer, then store the integer to indicate the species on the delivery record. That way you can add species, change their names, add other characteristics, etc.
But you know more about the application than I do, so maybe that wouldn't work.
Good luck!
CQ de W5ALT
Walt Fair, Jr., P. E.
Comport Computing
Specializing in Technical Engineering Software
|
|
|
|
|
Two things spring to mind initially. One, why not use a real database, SQL Express is free and far superior to Access, and two, usng the species as a column name means every time you need to add a new species you have to alter your table. Put the species in one table and the record of catches in another - probably there ought to be a further table with the fisherman details too. Get a book on database design before going any further, as using your current design is asking for trouble in the future.
In answer to your question, you can manipulate the data within your code to do what you want, but if you use SQL Express 2008 it can be done by using the PIVOT command.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Ashfield
I want to thank you and Walt Fair for the response. You both mentioned SQL Express and I will look into it. I do not do a lot of this sort of work, that is why I am still using vb.net 2003. I used an Access database because that it what I had handy, but I am early enough in this project that I can switch easily.
As far as the species names as column headings. I understand your point, but for good or bad, the fishery that this program is to used in is one that is managed by the Federal Governemnt and has a management plan that identifies exactly the species involved, so adding new species will not be an issue.
|
|
|
|
|
Hi Peter,
I believe you get SQL Express for free with Visual Studio 2005 as part of the VS 2005 installation. With 2003, you will have to download it and install it. I would suggest upgrading.
Glenn
|
|
|
|
|
Peter Leipzig wrote: As far as the species names as column headings. I understand your point, but for good or bad, the fishery that this program is to used in is one that is managed by the Federal Governemnt and has a management plan that identifies exactly the species involved, so adding new species will not be an issue.
Even so, you should bear in mind that this is a bad design which, although it may not cause you problems in this instance should really not be used - better to do it right every time rather than taking shortcuts which can soon lead to general sloppiness.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Hi,
This should be very straight forward but I am missing something. I have a database in MS-Access to keep track of my Class Reunion information. The table is called "Reunion-Table". I'm trying to read this table with C# and fill a dataGrid. However, I'm receiving an OleDbException from the adapter.fill method, which is saying, Syntax error in FROM clause. Here's my code:
private void DataSetFromOleDb()
{
string strSQL =
"SELECT * FROM Reunion-Table";
try
{
using (OleDbDataAdapter adapter =
new OleDbDataAdapter(strSQL,
Properties.Settings.Default.OleDbConnectionString2))
{
DataSet ds = new DataSet();
adapter.Fill(ds, "Reunion-Table");
dataGridClassReunion.DataSource = ds.Tables["Reunion-Table"];
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
and here's my Connection string:
Provider=Microsoft.Jet.OLEDB.4.0;Data Source="H:\users\glenn\documents and settings\db1-0706.mdb"
Any help would be greatly appreciated.
Thank you,
Glenn
|
|
|
|
|
Hi,
The name of the table might be interpreted as two separate words. Can you try out the syntax below?
string strSQL = "SELECT * FROM [Reunion-Table]";
I are Troll
|
|
|
|
|
|
Intellitrace wasn't designed to be used in an end-user debugging situation. It was designed for use during development and especially during testing. Your testers can create or recreate problems problems and send you the log files so that you can see the steps that were used to get to the problem as well as what the code was thinking as the steps were being followed.
|
|
|
|
|
|
|
hi their, i just wanna to know the major difference between abstract class and interface...
till now i knew like Abstract class will have connection of internally related method's declaration but in interface will have collection of unrelated methods... am i correct?
|
|
|
|
|
balajict wrote: i just wanna to know the major difference between abstract class and interface
It's not a "major difference", but a few subtle differences. There's an article[^] on CodeProject that highlights the differences.
Enjoy
I are Troll
|
|
|
|
|
HI THEIR,
i gone throw the article .its good but they were explained only about how to implement and syntax
differences n multiple inherit but wat i expert na why we need tat? almost both does the same thing
but why we need tat apart from the given explanation ....
|
|
|
|