|
Then this is totally a data problem. You could try to partition your table...
Here is some light reading on the how and why.
Clcky[^]
hope this helps
Will
-- modified at 12:33 Monday 12th September, 2005
|
|
|
|
|
First of all the image data type can only hold 2GB of data so even if your operation didn't time out, it would fail. If you have to store documents which are that large, you are going to have to increase your command timeout. The connection timeout should only increase if the server is getting overloaded.
120,000 records is a relatively small amount for sql server to handle if indexes are setup properly. Make sure the indexes are on the table to support all your queries. If that doesn't fix the problem, then start looking to see if SQL server is bound up with disk or memory access from the large files, or if it is just load from the tables in the database.
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
|
|
|
|
|
Hi everybody !
I have a marvelous problem in deletion of a DataRow from a dataset table.I want my application to delete rows virtually.To aim that,I handeled the 'RowDeleted' event of the DataTable and in that event handler set the "Deleted" column of row (A bit column in SQLServer) to 1 and reject the changes of row to avoidance of row deletion after Updating the dataset to database.(I don't want the rows be deleted REALLY for undo capability of deletions).
See the code :
<code>
this.dataSet.Tables["tablename"].RowDeleted += new DataRowChangeEventHandle(RowDeleted);
private void RowDeleted(object sender, DataRowChangeEventArgs e)
{
e.Row.RejectChanges();
e.Row["Deleted"] = 1;
}
But when the 'e.Row.RejectChanges();' Executes I receive the following Exception :
System.Data.DeletedRowInaccessibleException : Deleted row information cannot be accessed through the row.
Wonderful thing is that when I replace the above code with the following code, everything is ok and the RowState is changed to UnChanged after Catch block !!!!
<code>
private void RowDeleted(object sender, DataRowChangeEventArgs e)
{
try
{
e.Row.RejectChanges();
}
catch{}
e.Row["Deleted"] = 1;
}
How can I do with this problem ?
Sorry for bad english.Thanx alot !
[ _ Always there is another way _ ]
|
|
|
|
|
Assuming your DataTable is bounded to a DataGrid, I think this is not the best way to do it.
To do virtual deletes, you can use the default DataView and add a RowFilter with the condition "Deleted != 1".
It will display only the Rows with "Deleted != 1".
I hope this helps.
Thanks
-- modified at 13:56 Friday 9th September, 2005
|
|
|
|
|
Thanx for your help.That is true.I used the dataview with
<code>RowFilter = "Deleted != 1"
But this is just a Mask for VIEWING. I have problem when I want to set the Dleted column to 1 !! After setting this column everything will masked with a dataview RowFilter.
<code>
this.dataSet.Tables["tablename"].RowDeleted += new DataRowChangeEventHandle(RowDeleted);
private void RowDeleted(object sender, DataRowChangeEventArgs e)
{
<font color=red>My problem is Here</font>
<font color=green>
</font>
e.Row.RejectChanges();
e.Row["Deleted"] = 1;
}
Thanx for your attention
[ _ Always there is another way _ ]
-- modified at 0:44 Saturday 10th September, 2005
|
|
|
|
|
I think I understand your problem correctly now.
My bet will be to subclass DataGrid that you are using and add the following method
public override bool PreProcessMessage( ref Message msg )
{
Keys keyCode = (Keys)(int)msg.WParam & Keys.KeyCode;
if(msg.Msg == WM_KEYDOWN
&& keyCode == Keys.Delete
&& ((DataView) this.DataSource).AllowDelete)
{
//Do something here(like row["Deleted"] = 1);
// return true will make sure the Row is not deleted.
return true;
}
return base.PreProcessMessage(ref msg);
}
|
|
|
|
|
How can i hide a database to be listed in sql enterprise manager else how can i prevent data from being deleted in a table through enterprise manager
|
|
|
|
|
Make sure only authorized users have rights to make changes to the database. If users have access to their own SQL user names and passwords for an application then you can't prevent them from using other access tools.
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
|
|
|
|
|
smita_roy wrote:
How can i hide a database to be listed in sql enterprise manager
=> No u cannot hide ur DB in SQL Enterprise Manager, I think. Because this GUI used to manage Databases
smita_roy wrote:
how can i prevent data from being deleted in a table through enterprise manager
=> u need to ensure that there's no one knows ur DB password except u
<< >>
|
|
|
|
|
(1) How can i hide a database to be listed in sql enterprise manager ?
Just Detach the Database in the Enterprise Manager.
(2) How can i prevent data from being deleted in a table through enterprise manager ?
Remove the permission from the user
REVOKE priv_type [(column_list)] [, priv_type [(column_list)]] ...
ON [object_type] {tbl_name | * | *.* | db_name.*}
FROM user [, user] ...
REVOKE ALL PRIVILEGES, GRANT OPTION FROM user [, user] ...
|
|
|
|
|
I have a simple insertinto statement with the correct syntax:
INSERT INTO BookingBook ('Date') Values ('01/01/2006');
Why is it throwing up the error that there is no such field as date when there most definitely is... Does the fact that it is a reserved word have anything to do with it...
Thanks.
°[Halo]°
Project Basilisk
|
|
|
|
|
INSERT INTO BookingBook ([Date]) Values ('01/01/2006');
The apostrophes indicate a string literal. Use square brackets or quotes.
My: Blog | Photos
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucious
|
|
|
|
|
°[Halo]° wrote:
INSERT INTO BookingBook ('Date') Values ('01/01/2006');
the field name is not qouted by brackets, the correct one should be
INSERT INTO BookingBook (Date) Values ('01/01/2006')
u can refer in SQL book online
<< >>
|
|
|
|
|
You could convert the string date on the fly ( if your usinf TSQL )
<br />
INSERT INTO BookingBook ('Date') <br />
Values ((Convert( datetime, '01/01/2005', 103 ))<br />
103 is DD/MM/YYYY
I prefer stating the exact date to SQL as it stops date problems with mixing up DD and MM.
|
|
|
|
|
INSERT INTO BookingBook ([Date])
Values ((Convert( datetime, '01/01/2005', 103 ))
|
|
|
|
|
Using sq brackets did not solve this. This provided me also with the error "INSERT INTO statement contains an unknown field 'Date'" or something to that effect. In the end I just changed the field name... I believe that access is reading "Date" as an identifier rather than a field name where it expects a field name...?
°[Halo]°
Project Basilisk
|
|
|
|
|
Quite possibly. If this is on MS SQL, try using brackets [] around the field.
|
|
|
|
|
Doh.. replies didnt show up at first. Ignore redundant post.
|
|
|
|
|
Hi !
I want to search the field of "telephone":
table:MyTable ,
id_name[int],name[nvarchar],family[nvarchar],telephone[decimal]. id_name is a primary key .
when I want to search a telephone , for example:
telephone=3339964
I write in c#:
string mysearch;
mysearch="SELECT * From MyTable WHERE telephone=3339964"; Now , If the telephone is NULL (one don't enter his telephone) and I want to search this name and family,How can I write this SQL ?
mostafa hosseiny b.
|
|
|
|
|
So, you want a query that will search by telephone. If telephone is null you want to seach by name and family instead.
This is the query you want:
SELECT *
FROM MyTable
WHERE (telephone=@telephone AND @telephone IS NOT NULL)
OR ((family = @family AND name = @name) AND @telephone IS NULL)
And the C# code to go with it:
string mySearch = "SELECT * "+
"FROM MyTable "+
"WHERE (telephone=@telephone AND @telephone IS NOT NULL) "+
"OR ((family = @family AND name = @name) AND @telephone IS NULL)";
SqlCommand cmd = SqlCommand(mySearch, myConnection);
cmd.Parameters.Add("@telephone", telephoneNumber);
cmd.Parameters.Add("@name", name);
cmd.Parameters.Add("@family", family);
SqlDataReader reader = cmd.ExecuteReader();
while(reader.Read())
{
}
From the code above telephoneNumber needs to be an object as it needs to be able to supply a System.DBNull.Value in place of the number. You could set this up like this:
object telephoneNumber;
if (telephoneNumberTextBox.Text == "")
telephoneNumber = System.DBNull.Value;
else
telephoneNumber = telephoneNumberTextBox.Text;
By the way, I'm not sure storing a telephone number as a decimal is the best approach. Certainly I've always stored them as strings and I've never seen them stored in any numeric format. How do you deal with phone number that start with a zero, or international numbers that are stored with a country independent prefix of +, or special service phone numbers that include the * or #.
Does this help?
My: Blog | Photos
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucious
|
|
|
|
|
Thanks in advance !!;)
mostafa hosseiny b.
|
|
|
|
|
manije wrote:
Thanks in advance
Are you a time traveller??
My: Blog | Photos
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucious
|
|
|
|
|
yes , and I do'nt Know , How do you understand .
Ofcourse , your guide , was very good and my means , was the same I want .
'@myVar IS NULL' .
Thanks again , but instead of using
'@myVar' , I use field name directly and I'd no problem but Really I do'nt know,How can Use with
'@'=variable in sql in c# .
Thanks,again .
mostafa hosseiny b.
|
|
|
|
|
I'll repeat my example with greater annotation:
string mySearch = "SELECT * "+"FROM MyTable "+
"WHERE (telephone=@telephone AND @telephone IS NOT NULL) "+
"OR ((family = @family AND name = @name) AND @telephone IS NULL)";
SqlCommand cmd = SqlCommand(mySearch, myConnection);
cmd.Parameters.Add("@telephone", telephoneNumber);
cmd.Parameters.Add("@name", name);
cmd.Parameters.Add("@family", family);
SqlDataReader reader = cmd.ExecuteReader();
while(reader.Read())
{
}
manije wrote:
but instead of using @myVar, I use field name directly and I'd no problem
These are two separate things. I cannot see how that would work without seeing your code. I suspect that there is some confusion with terminology here.
My: Blog | Photos
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucious
|
|
|
|
|
My Means is :
I do'nt know About variable in sql (like this :@telephone), or atleast I do'nt know,that what's
@telephone
in the code you wrote me(in c#).only I know ,it's a variable in SQL , but , How To Use!!!
thanks for patient .
mostafa hosseiny b.
|
|
|
|