473,395 Members | 1,532 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.

Documents on MDI forms with Dataset?

al
Greetings,

Thanks in advance for your kind attension.

I have been searching for documents about dynamically coding MDI forms
when working with datasets. Does anyone know of any???

MTIA,
Grawsha
Nov 20 '05 #1
6 1294
"al" <gr*********@yahoo.com> schrieb

I have been searching for documents about dynamically coding MDI
forms when working with datasets. Does anyone know of any???


Apart from <F1> I don't know any documents. ;-)

Do you have a specific question? Maybe I can help.
--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #2
al
"Armin Zingler" <az*******@freenet.de> wrote in message news:<uv**************@TK2MSFTNGP11.phx.gbl>...
"al" <gr*********@yahoo.com> schrieb

I have been searching for documents about dynamically coding MDI
forms when working with datasets. Does anyone know of any???


Apart from <F1> I don't know any documents. ;-)

Do you have a specific question? Maybe I can help.


I basically look for a way to avoid hard coding column names in the
SQL statement when I send changes (delete,udate and insert) back to
the database(i'm still working on the logical development. of the
app). The case is like thsi: I have a MDI form with a couple of
children forms(employees and customers). The related datatables(dt) in
the dataset(ds) is filled from database when its related form is
first loaded(table customer is filled when form customer is first
loaded). I refer to AciveMdiChild.Text in the MDI parent to load that
child form.

User, say, deletes a record by clicking a button to send the changes
to the database. There will be one button (on the toolbar of MDI
parent)for each operation (delet, update and insert). Now, my
problem comes when I try to write the SQL statement to send changes
back to database. That is, I don't want to hard code the column name
like this:

Dim str as String="Delete from employees where employeeID=@employeeid"

This will force me to write another SQL stat. for the the customers
form, which I do not want to do.

In this string, I was able to substitute the table name with the
ActiveMdiChilde.Text property. Now, to substitue the column name, I
look at the location of the related column name in the underlyning
datatable in the dataset, but the problem this column(usually Primary
Key,PK) does not have fixed location(it might be col 0 in one
employees table but col 1 in customers table ) or it might be 2
columns in some cases.

This is still hard coding the location of the column name:

Dim str as String="Delete from" & ActiveMdiChild.Text & " where " &
ds.tables _(ActiveMdiChild.Text).Columns(0).ColumnName & "=@" &
ds.tables _(ActiveMdiChild.Text).Columns(0).ColumnName

How should I DYNAMICALL refer to the location of the column name in
the underlyning datatable??
Should I use class or interface or what??? Remember, the
ActiveMdiChild is a basic form with basic properties,i.e., I can't
refer to labels or textboxes of the child form. ONLY names,text,etc..

MTIA,
Grawsha
Nov 20 '05 #3
Cor
Hi Al,

A dataset is never doing things with the MDI form direct but always with
controls placed on it, which can interact with dataset.

Therefore I do not see why there should be an answer for your question, can
you explain it something more?

Cor
I have been searching for documents about dynamically coding MDI forms
when working with datasets. Does anyone know of any???

Nov 20 '05 #4
"al" <gr*********@yahoo.com> schrieb

I have been searching for documents about dynamically coding
MDI forms when working with datasets. Does anyone know of
any???


Apart from <F1> I don't know any documents. ;-)

Do you have a specific question? Maybe I can help.


[...]
How should I DYNAMICALL refer to the location of the column name
in the underlyning datatable??
Should I use class or interface or what??? Remember, the
ActiveMdiChild is a basic form with basic properties,i.e., I can't
refer to labels or textboxes of the child form. ONLY
names,text,etc..


I don't think there is a short answer that explains the details. I can only
give a general answer: I'd store the information on a table somewhere and
pass it to each child. How this can be done is an individual design
question - and I'm usually getting paid for more details. ;-) If you've got
all information about the structure of the table in a DataTable, you can
dynamically built the Form, the SQL and whatever, based on this information.
For example, you can use a loop to process all columns, to build the SQL
string and to fill the Parameters. If you use a Commandbuilder, it's
(usually) sufficient to build the select string and the other SQL strings
(update/delete) are built for you.
--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #5
al
"Cor" <no*@non.com> wrote in message news:<#S**************@TK2MSFTNGP12.phx.gbl>...
Hi Al,

A dataset is never doing things with the MDI form direct but always with
controls placed on it, which can interact with dataset.

Therefore I do not see why there should be an answer for your question, can
you explain it something more?

Cor
I have been searching for documents about dynamically coding MDI forms
when working with datasets. Does anyone know of any???

Hello Cor,

The basic delma i'm facing comes from two sides. One is User
Interface (UI) requirments and second to be effeciant with coding.
For the first part, there is supposed to be only one button(on toolbar
of the MDI parent) for each database operation. One button to do only
one job(button for update, another for insert and third for delete),
so that both forms use it, or for as many forms as needed, for this
matter. This leads to the second part of the problem. That is, say a
user clicks the delete button, this forces me to have IF condition to
test for the ActiveMdiChild and see which of the children forms is
active. This way I will have to hard code for all of the children
forms. I don't want to that!
Now, having said that, I want to be more specific to get the "big
picture".
With the delete operation , for example,I use SQL statement to send
chagnes to DB.

"Delete from employees where employeeid=@employeeid"

If I do something like this, then i have to do it for all child forms.
What I want is to write ONE delete statement for all forms, i.e.,
DYANMIC one.
I was able to produce the following to get ONE dynamic SQL statement
for All child forms:

NOTE:
************************************************** ****************************
ActiveMdiChild.Text reads the child form's TEXT property, which is the
same as the table name in the dataset,i.e., customers form has
CUSTOMERS name as its text
************************************************** *****************************

IF Me.Toolbar.button.text = "Delete" Then

"Delete from" & ActiveMdiChild.Text & " where" & ds.tables
(ActiveMdiChild.Text).Columns(0).ColumnName & "=@" &
ActiMdiChi.Text.Column (0).ColumnName

End If

Here, I don' know how to create the dyanmic column location, instead
of hardcoding the location to 0.
Grawsha
Nov 20 '05 #6
Cor
Hi Al,

I type it in here not in the designer so check it good

I have still to asume a lot but I see you use a dataset, I start asuming
that you use datagrids or something and that you want to delete a row from a
dataset from which you know the dataset row.

I think you can than use a shared class for this
\\\
public class Al
public shared sub AlsDelete(byval ds as dataset, byval tabl as string,
byval row as integer)
ds.tables(tabl).rows(row).delete
end sub
end class
///
And then when you want to delete a row
\\\
IF Me.Toolbar.button.text = "Delete" Then
Al.alsdelete(ds,"ActiveMdiChild",rowposition)
End If
///
You can give it a try.

Cor
Nov 20 '05 #7

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

Similar topics

3
by: Patrick | last post by:
I have got 2 XML documents, both of which conform to the same XSD Schema, which define possible optional elements. The 2 XML documents contain 2 disjoint set of XML elements. What is the best,...
4
by: 2003et | last post by:
Couldn't I create DataSet in child forms???? Is there any solution for this??? Thanks in advance! E.T.
8
by: Grant | last post by:
Sorry for all the posts - Im new to c# and oop and and having a tough time geting my head around some of this stuff. (I tell you Im surprised my monitor has lasted this long, Ive been tempted many...
0
by: Anonieko Ramos | last post by:
ASP.NET Forms Authentication Best Practices Dr. Dobb's Journal February 2004 Protecting user information is critical By Douglas Reilly Douglas is the author of Designing Microsoft ASP.NET...
4
by: Lewis Edward Moten III | last post by:
I have a file that users can download through a web page protected by forms authentication: Download.aspx?ID=45 and within that file ... FileInfo fileToDownload = new FileInfo(fileName);
2
by: John Granade | last post by:
I'm looking for the best way to make a dataset available from multiple Windows forms. The dataset is created from an XML file. I have a main form (frmMain) that loads the dataset and reads the...
3
by: Geraldine Hobley | last post by:
Hello, In my project I am inheriting several forms. However when I inherit from a form and add additional subroutines and methods to my inherited form I get all sorts of problems. e.g. I sometimes...
4
by: etuncer | last post by:
Hello All, I have Access 2003, and am trying to build a database for my small company. I want to be able to create a word document based on the data entered through a form. the real question is...
0
by: grmiked | last post by:
Hallo everybody, I am working with VS2005 and have a major problem with VC++ and Crystal Reports that has been driving me crazy for the last 1 week! More specifically, my problem situation can...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...

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.