|
Hello all,
A quick question, I’m working on designing a SQL (7.0) database and for 37 of the tables I have 2 fields that are common between them and I’m using these 2 fields as the primary key for the 37 tables and also as the Foreign key to define the relations between these tables.
For example: <br />
Project_ID1: part of the Primary Key<br />
Project_ID2: part of the Primary key<br />
Both of them together form the primary key for the 37 tables because they are the only unique fields within each table. And when I create a relation between 2 of the tables I use these same 2 fields as the foreign keys
So, I would just like to get your opinion on if that is a correct design or not, I had some people telling me that this is a poor design?
Thanks in advance
|
|
|
|
|
I didn't really understand right.
Questions:
1. These 37 Tables do they all have the same Fields or what is different between them.
2. Do you store different Projects in different Tables?
3. Just show me the first 4 Fields of two Tables that I can understand.
4. What is the relation between the Tables?
Database Design is more difficult than many people think. A good structure may help the developers.
Please tell me more.
Stefan
|
|
|
|
|
confusedconfused:Can anybody suggest some online tutorials for ADO.Net? I've gone through several but they all tell you how to connect to a database, download the info and then Console.WriteLine() the results.
but i want some more realistic..In real world application we need to work with the results in datasets. Getting into the detail of evaluating data within the tables/datasets to determine what changes have been made?
Taking a subset of one of the tables and creating a new table and returning only that.
Just wondering if anybody can suggest some online tutorials.
phani.
|
|
|
|
|
This[^] may be helpful.
"Some people are like Slinkies... not really good for anything, but you still can't help but smile when you see one tumble down the stairs."
|
|
|
|
|
Hi,
I need to generate menus at runtime for a sample Windows application. I'm using vs.net winforms with c#.
Every user in the application does not have access to all menu options, so the menu items being displayed is as per user login.
I need to generate the form code at run-time. Any info you can provide OR links about this particular topic will be very helpful and appreciated with a zillion thanx...
It seems i need to following at runtime...
1) Retrieve data from the sql database about the menu options available to the current user
2) Declare each Menu item
private System.Windows.Forms.MainMenu mainMenu1;
private System.Windows.Forms.MenuItem menuItem1;
...
2) Initialize each menu item
this.mainMenu1 = new System.Windows.Forms.MainMenu();
this.menuItem1 = new System.Windows.Forms.MenuItem();
...
3) Declare Menu Collections - add list of menuitems
this.mainMenu1.MenuItems.AddRange(new
System.Windows.Forms.MenuItem[] {
this.menuItem1,
this.menuItem5});
...
4) Define each Menu Item
i.e. specify Index, Shortcut Key, Text (with hotkey) and declare eventhandler for each Menu item
this.menuItem2.Index = 0;
this.menuItem2.Shortcut=
System.Windows.Forms.Shortcut.CtrlN;
this.menuItem2.Text = "&New";
this.menuItem12.Click += new System.EventHandler(this.menuItem12_Click);
5) Assign the menu to Form as the current menu
this.Menu= mainMenu1;
Hope u guys will be keen to help. Thanx in advance.
Sunny.
|
|
|
|
|
What I usually do, is build the whole menu in the application. Then, when the user login in the application, I get an arraylist with all the menu options. After that, I execute a loop on the array list, and turn of all the options the user doesn't have access.
May be that could help you
Free your mind...
|
|
|
|
|
Hi Guillermo,
Thanx for your post. Your method seems to make much, much more sense than what i was trying to do. I just checked out the help files - i can either disable a menuitem or hide it completely.
>> menuitem3.enabled=false; // to disable a menuitem
>> menuitem3.Visible=false; // to hide a menuitem
I'll try out your method. Hope u can guide me, if i get stuck somewhere. Thanx a lot again.
Sunny
|
|
|
|
|
Concurrency violation: the UpdateCommand affected 0 records.
I get this error when I try to call Update() on an SqlDataAdapter using a DataSet which has been changed by another class. I've checked that the UpdateCommand.CommandText is properly set, all the parameters have the right SourceColumns, and that the DataSet has actually been changed. So what else could it be?
I'd post some code up here but since all those things are working OK I don't know where the error would be. Has anyone else solved this problem before? It's really baffling me.
|
|
|
|
|
I believe it means that someone has modified the underlying data from how it was before the data set was modified.
The DataSet object remembers what your original selection was. It then compares the rows in the data source to that original version, and if they've changed, it throws an exception rather than perform the update. This is to allow you to resolve the conflict between the change you're trying to make and the change that has already been made.
I seem to recall that there was an article in MSDN Magazine or on MSDN Online recently, but I can't seem to find it.
|
|
|
|
|
Hey, I think I found the article you mean. It didn't really apply to me since I'm not using the command builder, but it did point me in the right direction - I had to call GetChanges or else it wouldn't let me update at all (even though I know for a fact that the records couldn't have been changed). Still calling GetChanges (or refilling the dataset, my original tactic but an expensive one) makes the exception go away.
|
|
|
|
|
This may or may not relate to you situation, but I got the same exception when I had the wrong number of parameters added to my Update command using the OleDbDataAdapter. If you remove fields from the CommandText, but don't remove the related parameter from the commands ParameterCollection, it'll throw this exception for some strange reason. I would have thought it would just ignore the extra parameters, but it doesn't.
|
|
|
|
|
Thanks for your reply. I solved the problem - I just had to call GetChanges and get a new set before it would let me update. There are certainly a lot of quirks in this system! I'll keep your tip in mind if I get that error again - I can't imagine what you must have gone through to work it out.
|
|
|
|
|
I have a batch file where I am put a file into ftp site. The problem is that my file name are changing every day. How do I supply this file into batch file?
Or is any other way to do this?
open ftp.site
user test
pass test
lcd C:\
cd ..
put test.txt
bye
|
|
|
|
|
There are a couple of possible solutions:
1. Create a simple program that creates a fresh FTP script each day. Example BAT file:
@echo off<br />
echo open ftp.site > myftpscript.txt<br />
echo user test >> myftpscript.txt<br />
echo etc >> myftpscript.txt<br />
echo put %%1 >> myftpscript.txt<br />
echo bye >> myftpscript.txt<br />
ftp -n -s:myftpscript.txt
2. Use "mput *.txt" instead of "put test.txt" to transfer all matching files from your source directory.
Hope this helps.
Andy
PS: This was probably the wrong forum to post this question to.
|
|
|
|
|
anyone knows where can I get a Beta version of this enterprise server??!!
nevhile.net
|
|
|
|
|
There's a very small beta program at the moment; the SQL Server team normally does three betas, at 100, 1000 and 5000 customer sites.
Beg nicely at http://www.betaplace.com/[^].
Bear in mind that the CLR functionality (writing stored procedures and functions in .NET languages) is yet to be fully set in stone.
If you go along to the PDC[^] there might be a hand-out of Yukon beta code.
|
|
|
|
|
Hello folks, I have been traversing the net for information on this particular thing I want to have happen:
1. Execute a FROM XML EXPLICIT SQL Server 2000 query to get an XML document, which lists users per role, eg.
<Role role_id="1" role_name="administrator">
<User user_id="1" user_login="admin"/>
<User user_id="2" user_login="drikusr"/>
</Role>
2. This result is read into a Dataset (C#), eg.
objXMLReader = (XmlTextReader)objCommand.ExecuteXmlReader();
objDataSet.ReadXml(objXMLReader, XmlReadMode.InferSchema);
3.I seem able to easily manipulate the dataset when employing the following code:
strXmlDocument = (objDataSet.GetXml());
this.xmlObject.Document.LoadXml(strXmlDocument); Which enables the XML document to be read into a string variable, ie. strXmlDocument
On the other hand, synchronizing the Dataset with an XMLDataDocument, eg.
xmlDoc = new XmlDataDocument(objDataSet); and loading a transformation, eg.
XslTransform xslTran = new XslTransform();
xslTran.Load(xsltPath);
upon which the following code is executed:
stringWriter = new StringWriter();
xmlWriter = new XmlTextWriter(stringWriter);
xmlWriter.Formatting = Formatting.Indented;
xmlWriter.Indentation = 2;
xslTran.Transform(xmlDoc,null,xmlWriter,null);
this.txtFormattedXML.Text = stringWriter.ToString();
stringWriter.Close();
xmlWriter.Close();
returns an XSLT processed XML document, but with the actual data missing, which was read from the database.
For example:
The first set of commands produce this XML document that has the Role data included:
<?xml version='1.0' encoding='utf-8'?>
<NewDataSet><Role role_id="1" role_name="administrator">
<User user_id="1" user_login="admin"></User>
<User user_id="2" user_login="drikusr"></User>
</Role></NewDataSet>
The XMLDataDocument and XSLT transform (with missing data) results in:
<html xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<head>
<link rel="stylesheet" href="css_stylesheets/netLc_Styles.css" />
</head>
<body>
</body>
</html>
Has anyone done an end-to-end FOR XML EXPLICIT to ADO.Net solution and hence manipulated the XML (all in memory) displaying it on the UI and getting back changes which are written to the Database by ADO.Net?
All the examples on the net keep stuffing around with XML documents located on the file system and every single "FOR XML EXPLICIT" and ADO.Net example (usually the same one re-hashed on different sites ) stop short at the Dataset, with no client rendering.
As you might be able to tell, I don't have a lot of .Net experience, so I may be overlooking the obvious.
Your help is appreciated!
Regards
Drikus
|
|
|
|
|
Well, I sort of got this resolved. After reading volumes on the synchronisation of the Dataset and XMLDataDocument (andapplying XSLT, for an SQL Server FOR XML EXPLICIT query), I have conluded that the XMLDataDocument is not the way to go.
Instead, after executing the stored porcedure (which gets the Explicit XML result), eg.
objXMLReader = (XmlTextReader)objCommand.ExecuteXmlReader();
and reading the result into a Dataset, eg.
objDataSet.ReadXml(objXMLReader, XmlReadMode.InferSchema);
rather create an XPathDocument, eg.
myXPathDocument = new XPathDocument(objXMLReader, XmlSpace.Preserve);
and load the XSLT transformation, eg.
XslTransform xslTran = new XslTransform();
xslTran.Load(xsltPath);
then perfrom the transformation and output both the HTML result, as well as the HTML code to web objects for display, eg.
stringWriter = new StringWriter();
XmlTextWriter writer = new XmlTextWriter(stringWriter);
writer.Formatting = Formatting.Indented;
writer.Indentation = 2;
writer.QuoteChar = '\'';
xslTran.Transform(myXPathDocument,null,writer,null);
writer.Close();
this.txtFormattedXML.Text = stringWriter.ToString();
this.lblHTMLOutput.Text = stringWriter.ToString();
The quest has but begun...
|
|
|
|
|
In nutshell, there is DataTable within DataSet. One of DataTable's columns is expression-based. Afer I tried to update database (via use DataAdapter.Update(DataTable)), following exception occured:
An unhandled exception of type 'System.Data.VersionNotFoundException' occurred in system.data.dll
Additional information: There is no Original data to access.
HELP!
|
|
|
|
|
Try writing yourself the Update command for the DataAdapter, omitting the calculated column...
Free your mind...
|
|
|
|
|
|
Hi,
Environment of web application is: Windows 2000/VB.NET/ASP.NET/SQL 2000
I am passing an XML to the sproc and reading it using OPENXML. There is a date value coming as one of the parameters. Sometimes, the date can be blank.
Now how can I use CASE..END in WITH section to decide, if its a blank then use NULL else pass the incoming date? See the following scenario.
Select *
from OPENXML (@idoc,'/TaskDetail',1)
with
(
ClosedDate smalldatetime 'ClosedDate',
)
Please advice.
Thanks
Pankaj
Follow your goals, Means will follow you ---Gandhi---
|
|
|
|
|
I have a c# application that does frequent checks to the database to see if a status flag in a table has changed.
After the query, I close the connection and command objects with
connection.Close() and
command.Dispose()
If I look at the current activity in SQL Server, I see each of these queries as sleeping processes that just continue to accumulate. What am I missing that keeps these processes around after the query completes?
If it makes a difference, I am using MSDE.
Thanks in advance,
Bruce
|
|
|
|
|
Hi!
I am using sql server 2000. How do I make my DB case sensitive without reinstalling sql server 2k?
Please help me on this.
"To teach is to learn twice"
|
|
|
|
|
Reinstalling won't help. You bought the wrong product. You should have purchased SQL Server 2K.
|
|
|
|