|
This is what I've tried so far, but it resets on every page.
So, each page is 1 even if the Unique ID spans 2-3 pages.
I only need it to reset on a new field grouping of the list object.
Here's the VB code for the report:
Shared offset As Integer
Public Function GetPN(reset As Boolean, pagenumber As Integer) As Integer
If reset
offset = pagenumber - 1
End If
Return pagenumber - offset
End Function
***************************
In the header, I have a textbox named "tag"
In the footer, I've got the following expression:
="Unique ID Page: " & Code.GetPN(Not(ReportItems!tag.Value Is Nothing),Globals!PageNumber)
|
|
|
|
|
My fault...I had the textbox "tag" in the page header and not in the list object itself.
It works!
Thanks!
-- modified at 17:02 Thursday 22nd September, 2005
|
|
|
|
|
this query is perfect in Ms-Access but its not working in Sql Server
UPDATE EmpDept INNER JOIN clockings ON EmpDept.clockno=clockings.clockno SET clockings.deptid = empDept.deptid;
it shows following error msg.
Incorrect syntax near the keyword 'INNER'.
Naveed Kamboh
|
|
|
|
|
The basic syntax of UPDATE statement in SQL Server is
UPDATE {table_name | view_name}
SET column_name1 = {expression1 | NULL | DEFAULT | (SELECT)}
[, column_name2 = {expression2 | NULL | DEFAULT | (SELECT)}
[ ,...n ]
WHERE {search_conditions}
Try this.
UPDATE clockings SET clockings.deptid = ( SELECT EmpDept.deptid from EmpDept WHERE clockings.clockno = EmpDept.clockno )
|
|
|
|
|
I have used UPDATE s with JOIN s before, and it works in SQL Server. I believe the SET clause should come before the JOIN , and also, that you need a FROM clause before any JOIN .
Try this:
UPDATE clockings SET clockings.deptid = empDept.deptid
FROM EmpDept
WHERE EmpDept.clockno = clockings.clockno I hope this helps!
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
The amount of sleep the average person needs is five more minutes. -- Vikram A Punathambekar, Aug. 11, 2005
|
|
|
|
|
Thanks LuisR
Your query affected 46311 while i have 48410 rows but query worked cheers
Naveed Kamboh
|
|
|
|
|
I would like to know how to check for 'NO RECORD FOUND' after a Select statement.
I am not sure about 'SQLCODE or SQLSTATE'. Please Help!!
Norm;P
|
|
|
|
|
Use COUNT to see if any records are returned.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
If this is inside a stored procedure check for
select @@rowcount.
If you want to check this in ADO.NET, then
SqlCommand.ExecuteNonQuery() will return the no of rows selected.
|
|
|
|
|
I am trying to prevent duplicate records from being appended to my Access database. What I did was created two tables in Access. The first one "NewResultsTable" is populated with new records. I created a Query in Access "Query1" which appends the first database to the second database. The Table "NewResultsTable" is then cleared of all of its records.
The table "TestResultsTable" has three primary keys:TestDate, TestTime, and SerialNumber. So when I run "Query1" while in Access, if all three of those primary keys are the same as any other three primary keys I will get an error message similar to the following.
"Microsoft Access can't append all the records in the append query
Microsoft Access didn't add (Number of records) to the table due to key violations
To ignore the error and run the query, click Yes"
I click yes the records that aren't duplicates are appended to "TestResultsTable". I wrote a small test program in C# and called the "Query1".
When there where no duplicates the "TestResultsTable" is appended to no problem. When there are duplicates I get the following error.
"The changes you requested to the table were not successful because they would create duplicate values in the index, primary key, or relationship. Change the data in the field or fields that contain duplicate data, remove the index, or redefine the index to permit duplicate entries and try again."
I don't know how to tell Access to continue and run the query. How can I do this? Or would it be easier to write a SQL statement? What would the SQL statement be that would do this same thing?
Thanks to anyone who can help.
|
|
|
|
|
Why don't you write a query that doesn't cause the error ? Ideally you should not send duplicate data to the database, but your proc for doing an insert should first check if the unique ID exists, and perhaps if it does, do an update instead.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi,
Need some help. Say I have 5 rows in my table and I filled in 4 rows and submit it, now I want to add data to the 5th row by using an update statement.
It looks like this:
MainID | EntryDate | TechName | Software | Application | Problem | Solution
The Main ID is an int and the entrydate is a datetime. I fill in a form to add a problem. Now someone goes and click on the entry in a datagrid and then adds a solution.
Thanks for the HELP!!!
Illegal Operation
Making Computer Software Talk
|
|
|
|
|
You can iterate over the datagrid to find out which rows are changed, then you just fire an update statement for each row, or use OPENXML or something like that to pass all the rows in for one transaction.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Good Evening,
I'm working with C# code which presents a dataset with an id and name column, it also has an added expression column to concatentate the two as follows:
DataColumn aggregateCol = new DataColumn();
aggregateCol.DataType = System.Type.GetType("System.String");
aggregateCol.ColumnName = "strConcat";
aggregateCol.Expression = "Convert(id, System.String) + ' ' + name";
concatTable.Columns.Add(aggregateCol);
concatTable is passed to this code as: this.downtimeData.Tables["Equipment"]
to Test the result I printed the contents of the Datatable after it had been merged with a populated dataset as follows:
this.downtimeData.Merge(downtimeData);
System.Diagnostics.Debug.WriteLine(this.downtimeData.Tables["Equipment"].Rows.Count);
System.Diagnostics.Debug.WriteLine(this.downtimeData.Tables["Equipment"].Rows[0].ItemArray[0] + " " +
this.downtimeData.Tables["Equipment"].Rows[0].ItemArray[1] + " " +
this.downtimeData.Tables["Equipment"].Rows[0].ItemArray[2]);
And the perplexing print out reads:
3
1 spoon
Why does the strConcat field not contain a value?
Thanks in advance
A chicken is just an eggs was of making more eggs
-- modified at 6:20 Wednesday 21st September, 2005
A chicken is just an eggs way of making more eggs
|
|
|
|
|
Do you have a data table with Data Or Want to create and fill data table on fly ?
Sreejith Nair
[ My Articles ]
|
|
|
|
|
Hi,
I have a typed dataset with multiple tables, from this I obtain a reference to a table using a DataTable type. I use this reference to add an aditional column to the table/schema/dataset on the fly. I then merge this dataset with another of the same schema (without the aditional column) that is populated with data. I assume that the additional column should provide a value as it is an expression of other columns specified in the typed schema.
Cheers.
...
|
|
|
|
|
I figured out the solution... After I merged the populated dataset with my local dataset that has the extra column I had to set that columns expression again. I find this odd that my function added the new column and set the expression, but when the data is updated I have to respecify the expression for that column, but not re-add the column .
Could anyone tell me why things work this way?
Cheers.
|
|
|
|
|
is there a limit on the size of the "in memory" database it can hold?
"there is no spoon" biz stuff about me
|
|
|
|
|
It is limited by the amount of memory it can allocate through .net. I've seen datasets with 300,000 rows lockup processes on servers with 4Gigs of memory. The asp.net process only hit 1.5GB before the admins shut it down, but it wasn't doing anything other then paging at that point.
DataSets are not the most efficient structure on the planet. They have lots and lots of features and it shows. It appears they use roughly an object per cell and sometimes more if you keep track of changes to the data. They do serialize to xml well. Just don't expect them to load schemas fast. I just did a profile of a simple database application using typed datasets and 25% of the time was spent in the DataSet.LoadXml method, which was longer then the time spent actually getting data from the database.
It should be easy to code, just don't expect it to be blazing fast.
I can imagine the sinking feeling one would have after ordering my book,
only to find a laughably ridiculous theory with demented logic once the book arrives - Mark McCutcheon
|
|
|
|
|
not sure if this the right forum but here goes...
im trying to convert a source database into an xml file ... simple enough u say ... the problems are:
1. the target schema is totally different from the source database schema so some remapping of fields to different tables has to happen ... not sure if a built in solution exists for this or if i have to define my own remapping file and processing code?
2. the output has been given as an xsd file that contains about 7 or more tables ... when i try to read that into a dataset (using readxmlschema()) i get errors ... can a dataset schema only contain one table? if so how do i break the xsd file into single table xsd files?
3. im doing this in vb.net cos thats what the client wants ... are there any technologies in vb.net that can help me with this?
thnx in advance and i hope i didnt completely obfuscate my questions
"there is no spoon" biz stuff about me
|
|
|
|
|
1. If you can write a sql statement per output table you can put them in a data adapter and you should be able to just fill the dataset.
2. As long as it is a valid XSD schema, readXmlSchema should work fine. DataSets support multiple tables and relationships between them.
3. Vb.net, I'm sorry. You should be able to load the .xsd file into a vs.net project and generate a typed dataset. This should validate the xsd schema as well.
I can imagine the sinking feeling one would have after ordering my book,
only to find a laughably ridiculous theory with demented logic once the book arrives - Mark McCutcheon
|
|
|
|
|
I am looking for suggestions on maybe the best practices of allowing a user to add their own data fields to the database.
|
|
|
|
|
The safest solution (without the need of SQL script to create new tables and columns) is to create a table for each datatype you need.
When a client needs additional data fields, store this information in a table such as below:
idKey (autonumber) | Field Name | idDataType
1 Pager 1 (i.e. string)
From this table you can then link to a string table:
idKey (FK) | Value | idKey2 (for your own use)
1 9931212
We did this in our intranet. It's a bit more complex than just creating new tables and columns but with this the database structure can be kept intact.
Ed
|
|
|
|
|
I'd say the best practice is don't. If they are manipulating data, let alone the schema in the database outside of your application, they are taking the stability of the application into their hands.
Typically a request like this occurs because something isn't being addressed quickly enough through the current development process. It's usually best to fix the process rather then allow users to grab hold of the heart of your application and fiddle with it.
I can imagine the sinking feeling one would have after ordering my book,
only to find a laughably ridiculous theory with demented logic once the book arrives - Mark McCutcheon
|
|
|
|
|
I am displaying a ComboBox that hopefully contains the contents of a database table (a lookup of sorts). When the form loads, the ComboBox contains the correct values, all sorted.
However, when I try to select a value programitically, I can't (well, I can't select the correct one).
I create a dataset:
DataSet dsTitles = new DataSet("Titles");<br />
SqlCommand tableCommand = new SqlCommand();<br />
tableCommand.CommandText = "select TitleID, TitleDisplayText FROM tblTitles WHERE TitleHidden <> 1";<br />
<br />
SqlDataAdapter adapter = new SqlDataAdapter();<br />
adapter.SelectCommand = tableCommand;<br />
adapter.Fill(dsTitles, "Titles");
I then bind the dataset to the ComboBox:
comboBoxTitle.BeginUpdate();<br />
comboBoxTitle.DataSource = db.DataSetTitles.Tables["Titles"];<br />
comboBoxTitle.DisplayMember = "TitleDisplayText";<br />
comboBoxTitle.ValueMember = "TitleID";<br />
comboBoxTitle.EndUpdate();
So far, all is well. However, I can't seem to select the correct item. I've tried:
comboBoxTitle.SelectedValue = 2;<br />
Console.WriteLine("Current Title Index: {0} Text: {1} Combo Index: {2} Value: {3} Text: {4}", 2, db.LookupValueTitle(2), comboBoxTitle.SelectedIndex, comboBoxTitle.SelectedValue);<br />
TitleID of 2 matches TitleDisplayText of Mr, but nothing is visibily selected.
Current Title Index: 2 Text: Mr Combo Index: 0 Value: 2 Text: is what gets logged.
Any help would be appreciated.
--G
|
|
|
|