|
Have you read this: clickety[^]
--EricDV Sig---------
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them.
- Laurence J. Peters
|
|
|
|
|
My issue is the update of a dataBase table with a dataSet table as a parameter using C# and SQL Server 2005.
Below is the function I used in my code ---> verry simple.
I noticed that in line :updates = da.Update(tmpDS, tableName) ,updates variable is 0 ,so no update possible.
Perhaps this is not the way to do the update.
IF you can help me with some hints ,
Thanks in advance!
public DataSet dsUpdateData(DataSet ds, string tableName, string ConnectionString)
{
DataSet tmpDS = new DataSet();
try
{
SqlDataAdapter da = new SqlDataAdapter(SQLQuery + tableName, ConnectionString);
int updates = da.Fill(tmpDS,tableName);
foreach (DataRow dataRow in ds.Tables[tableName].Rows)
{
tmpDS.Tables[tableName].ImportRow(dataRow);
tmpDS.Tables[tableName].AcceptChanges();
}
updates = da.Update(tmpDS, tableName);
return tmpDS;
}
catch (Exception ex)
{
Debug.WriteLine(ex.ToString());
}
}
-- modified at 14:43 Tuesday 18th July, 2006
|
|
|
|
|
Check your table names. It appears you are importing rows into tableName1 but trying to update tableName
|
|
|
|
|
Yes you where right on that,but it was just a typo error tableName1.
Even so, it is still not working.
I modified the original message.
Thank you anyway!
|
|
|
|
|
Hi
in some applications i have seen that DataGrids have a Control which is the number of the DataGrid's Row and it has next( > ), previous, last and ...
whats the name of that control?
thanks
|
|
|
|
|
hamidreza_buddy wrote: whats the name of that control?
BindingNavigator or something like that?
|
|
|
|
|
Hi,
There is a requirement to insert data into Bulk like 20,000 - 30,000 rows into database (sql server 2005).
Description:
I have to get one number from text file,bifercate that number and from 1st 5 digit i have to find out ID from sql server 2005 table and then go for second number of that number ,find out ID from sql server 2005 table,this process happens for 4 times for that one number and i have to do same process for 20000 rows.
Once i get all those IDs into variables into vb.net from sql server 2005,i have to insert those into one physical table and than one package will run that insert those records into another table.
Here main problem i am feeling is speed issue,to process 20000 rows for getting ids and inserting back into sql server takes somuch time.
So can some body help me out which way to go to insert records into database using sql server 2005?
thanks
montu3377
|
|
|
|
|
You can Bulk insert (using BCP or managed SqlBulkCopy) the text file contents to a table and use a stored proc to do read from that table and insert/update into the target table.
|
|
|
|
|
Hi everyone,
I'm hoping someone can help me with some sql statements. I have a temp table that contains 30 dates that a student has missed in the last year. I also have a holiday table of when training was not available. I want to find out if there are 6 consecutive days missed excluding weekends and holidays (from the holiday table). I know this is some nasty looping statement but I can't get my brain around it.
I would like do this in a stored proc but I could use C# if necessary.
Thanks, Jessica
|
|
|
|
|
Why don't you give it a try, post your code, and we will help you where you are struggling. What you have provided here sounds too much like a school assignment. People aren't likely to do your assignment for you - but they will help you figure out the solution, provided you put forth an effort.
That's just my suggestion.
--EricDV Sig---------
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them.
- Laurence J. Peters
|
|
|
|
|
Nasty requirements - here is a first attempt using a cursor. I think I would change the EndDate calculation to a function so that you could remove the cursor.
DECLARE @StartDate DATETIME
DECLARE @EndDate DATETIME
DECLARE @cnt INTEGER
DECLARE cur CURSOR FOR
SELECT
AbsentDate
FROM
#tmpTable
OPEN cur
FETCH NEXT FROM cur INTO @StartDate
WHILE @@FETCH_STATUS = 0
BEGIN
SET @cnt = 0
SET @EndDate = @StartDate
WHILE @cnt < 6
BEGIN
SET @cnt = @cnt + 1
SET @EndDate = DATEADD(d,1,@EndDate)
WHILE (DATEPART(dw,@EndDate) IN (1,7)) OR
(EXISTS(SELECT * FROM Holidays
WHERE HolidayDate = @EndDate))
BEGIN
SET @EndDate = DATEADD(d,1,@EndDate)
END
END
IF ((SELECT COUNT(*)
FROM #tmpTable
WHERE AbsentDate BETWEEN @StartDate AND @EndDate) > 5)
BEGIN
-- Save Date
-- or do other desired processing
END
FETCH NEXT FROM cur INTO @StartDate
END
CLOSE cur
DEALLOCATE cur
|
|
|
|
|
Hi,
When I have the following:
db.AddOutParameter(dbCommand, "@ReturnCode", DbType.Int32, 4);
What does the 4 mean? Does it mean the highest number will 9999? Or what?
When adding the follwoing datatypes, what does the size indicate:
int - size = 4
ntext - size = 16
Please can someone help me with my confusion.
Regards,
ma se
|
|
|
|
|
The int size of 4 refers to the number of bytes required to store an integer (which has a precision (i.e. max number of digits) of 10). The 16 for an ntext size refers to the bytes to hold a pointer to the actual ntext data, which is stored outside of the sql server leaf.
|
|
|
|
|
Number of bytes.
In this case, as 32 bit integer takes up 4 bytes (32/8 = 4). Normally, I only add the size to chars, varchars and varbinarys. The defaults for the standard fields (like Int32) is well known by the system.
|
|
|
|
|
Hi
I have an SQL database under a MS2005 SQL Server.
This is a ~200MB databse that grows from time to time, only one person (Administrator) adds\removes data from this database.
On the other side I have a client application that uses this database. At the moment the the SQL database is locked and has stored procedures as an "API".
Since allot of users accessing the data is CPU consuming and takes allot of bandwidth I would like to have the database localy on the clinet side, *locked*, enabeling only the execution of the stored procedures with an option to sync' with the main database on the SQL server. The end user can't add\remove items from the main\local database nor does he have the login\password for his local database.
I started looking into this and found SQL express and SQL mobile (everywhere).
My quersion is, which of the above is more suited for my application ?
Thanks,
Gilad.
|
|
|
|
|
|
Thank you for your quick answer.
At the moment the database is ~200MB growing at a rate of 80k per day, thats about 30MB a year, not too much. 99.999% of the data never changes so I would like the history data to stay on the client side.
The client gets all the data it needs and just the data it needs, nothing extra. This is very optimized.
I have many users accessing the database at once and would like only to send them the 80k daily "update data" rather then all the data.
Gilad.
|
|
|
|
|
Right now, as far as I'm aware, SQL Everywhere is only a CTP, I don't think it's been released yet. SQL Everywhere doesn't have per-user or per-object security. It also doesn't have stored procedures. You'll need to use SQL Express.
Given the size of the database I'd look at SQL Express. You'd probably want to use transactional replication so that the size of updates is small. You would still have to connect to the master database to execute any stored procedures that change data.
You have to have some kind of credentials to log into any SQL Express database. I presume that you mean that you wouldn't give out the system administrator password. That's sensible. I would grant the <machine>\Users Windows login access to the database server and map it to a user in the 'public' role in the database, then use Windows Authentication to connect to the database - no separate password needed. I've not done this but I know that SQL Express can subscribe to replication publications.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
Hi Mike,
Thanks allot, you really hit the nail on its head.
I guess SQL everywhere\mobile isn't the solution for my situation.
Is SQL Express "Deployable" ? The client application is a "Click-One" App. Do I need a special liciense in order to use it on the client end ?
Thanks
Gilad.
|
|
|
|
|
You can distribute SQL Express to the client. Think of it as the replacement for MSDE, which it really is. You would probably need to have the client install SQL Express before your application, or have some code that runs at startup of your app to verify and install SQL Express prior to start up.
|
|
|
|
|
Hi,
I've got a small website which runs off an Access database (i know, i know - don't flame me) but Microsoft Access (as in the product) is not required on the server as it draws data through ADO; do you require any licenses to operate this?
Pol
|
|
|
|
|
The only link I can find is here[^], but this is in MSDN's Archive section so may well be out of date.
These days, Jet is under Windows File Protection on Windows 2000, XP and Server 2003, so it could probably be considered part of the operating system.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
i wish to connect to database at another PC by using C language,can anyone can tell me how to do that.ty
|
|
|
|
|
Attach via UNC share then use ADO.
Look where you want to go not where you don't want to crash.
Bikers Bible
|
|
|
|
|
can give me connection string coding. or any reference web sites ty
|
|
|
|