|
Hi
I have some records say 1000 Nos fetched from SQL and stored in a Dataset.
Now I need to fetch and store top 1-50 records in another dataset and top 51-100 records in another dtaset and so on.
Could any one help me how to transfer records from one Dataset to another dataset?
Regards
San
|
|
|
|
|
Create a DataView instead and use a row filter.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
i can't install sql 2005 beta 2 in my pc
it says .net frame work in corrupted or not installed but its running properly in my computer.
|
|
|
|
|
Hello,
We have several reports on the web that require printing. Now as I am sure all of you know it can be a pain to write all the code required to format the lines correctly so they dont wrap.
There is one report that I am thinking of that has caused me much pain in the past. It prints out all the operations and instructions to create a part. Well the operation descriptions can be quite long so I needed a way to accuratly print and count lines of text. I had written a class that would formatt the information breaking at the correct length for printing but the problem was the ammount of time it was costing me when the report would render. So I thought to my self.. Self.. wouldn't it be great if I had a function that would formatt the information for me so when I pulled it from the database all I had to do was display and count?
So I wrote a little function that does just that:
<br />
---------------------------------------------------------------------------<br />
CREATE FUNCTION F_FormatRevisionDescForPrint(@Desc VARCHAR(1000), @DisplayLenghOfString INT)<br />
RETURNS VARCHAR(2000)<br />
AS<br />
<br />
BEGIN<br />
DECLARE<br />
@CharacterCounter INT<br />
,@DescLen INT<br />
,@WhenToBreak INT<br />
,@FormattedDesc VARCHAR(2000)<br />
,@NewLine VARCHAR(2)<br />
,@Space VARCHAR(1)<br />
,@NextCharacter VARCHAR(1)<br />
,@PreviousCharacter VARCHAR(1)<br />
,@CurrentCharacter VARCHAR(1)<br />
,@NewString VARCHAR(2000)<br />
,@NumberOfCharactersToCut INT<br />
--<br />
SELECT @CharacterCounter = 0<br />
,@DescLen = LEN(@Desc)<br />
,@WhenToBreak = 0<br />
,@FormattedDesc = ''<br />
,@NewString = ''<br />
,@NewLine = CHAR(13) + CHAR(10)<br />
,@Space = ' '<br />
--<br />
IF (@DescLen > 0) BEGIN<br />
WHILE @CharacterCounter <= @DescLen BEGIN<br />
--<br />
SELECT @FormattedDesc = @FormattedDesc + SUBSTRING(@Desc,@CharacterCounter,1)<br />
,@CurrentCharacter = SUBSTRING(@Desc,@CharacterCounter,1)<br />
,@NextCharacter = SUBSTRING(@Desc,(@CharacterCounter+1),1)<br />
,@PreviousCharacter = SUBSTRING(@Desc,(@CharacterCounter-1),1)<br />
,@WhenToBreak = @WhenToBreak + 1<br />
--<br />
IF (@WhenToBreak = @DisplayLenghOfString) BEGIN<br />
-- I need to check and make sure that I am not breaking on<br />
-- a word.<br />
IF (@CurrentCharacter = @Space) BEGIN<br />
-- There is a space here so it is ok to break<br />
-- I know that I am not in the middle of a word<br />
SELECT @FormattedDesc = @FormattedDesc + '<BAR />'<br />
,@WhenToBreak = 0<br />
,@CharacterCounter = @CharacterCounter + 1<br />
-- <br />
END ELSE IF (@CurrentCharacter != @Space) BEGIN<br />
-- houston we have a problem I am somewhere in a word<br />
-- I have to go back in the string till I find a space.<br />
-- When I find a space I am going to remove the rest<br />
-- of the characters from the string.<br />
-- EX: String: A T<BR>OOL New String: A<BR> The word tool will be cut off.<br />
-- XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX<br />
-- reverse the string that way it will be<br />
-- easier to find the space<br />
SET @NewString = REVERSE(@FormattedDesc)<br />
-- get the first index of a space<br />
SET @NumberOfCharactersToCut = PATINDEX('% %',@NewString)-1<br />
-- now reverse the string again so it is no longer backwords<br />
SET @NewString = REVERSE(@NewString)<br />
--<br />
-- get the new substring<br />
SELECT @FormattedDesc = '' + SUBSTRING(@NewString,0,(LEN(@NewString)-@NumberOfCharactersToCut)) + '<BAR />'<br />
,@WhenToBreak = 0<br />
,@CharacterCounter = @CharacterCounter-@NumberOfCharactersToCut<br />
END<br />
<br />
END ELSE BEGIN<br />
--<br />
SELECT @CharacterCounter = @CharacterCounter + 1<br />
--<br />
END<br />
END<br />
END ELSE BEGIN<br />
SET @FormattedDesc = ''<br />
END<br />
<br />
RETURN @FormattedDesc<br />
<br />
END<br />
-------------------------------------------------------------------------<br />
Example of use:
<br />
SELECT REPLACE(LTRIM(RTRIM(dbo.F_FormatRevisionDescForPrint(Routing_Revisions_Edit.[Description],47))),'<BAR />','<BR>') AS Description<br />
FROM MyTable<br />
--------------------------------------------------------------------------
Well any thoughts are welcome.
Thanks
Will
|
|
|
|
|
Hi all,
I am getting this error when tring to access my page hosted on fast hosts;
ERROR [42S02] [MySQL][ODBC 3.51 Driver][mysqld-4.1.11-standard]Table 'touchofglass.products' doesn't exist
Now I have changed the products table to 'products' so that the table name is correct but it comes back with the error;
ERROR [42S02] [MySQL][ODBC 3.51 Driver][mysqld-4.1.11-standard]Table 'touchofglass.Products' doesn't exist
WOW, any body have any ideas on this, coz this one has completly thrown me!
I know that tables in MYSQL are case sensitive, but i cant think of anything else to try?
Cheers in advance
Stu
|
|
|
|
|
If a database is dettached and its log file (.ldf) has been deleted,
I am trying to attach this database again , but i am facing some problems.
Do someone have a solution for me ?
|
|
|
|
|
The command is sp_attach_db. Example:
EXEC sp_attach_db @dbname = N'pubs',
@filename1 = N'c:\Program Files\Microsoft SQL Server\MSSQL\Data\pubs.mdf',
@filename2 = N'c:\Program Files\Microsoft SQL Server\MSSQL\Data\pubs_log.ldf'
I prefer using a backup/restore approach.
|
|
|
|
|
Thank you my friend,
but my problem is that the Log.ldf file is not found (deleted), so @filename2 is invalid.
Do you have another way ?
|
|
|
|
|
Hello,
I am trying to insert a record in an Access database using Asp.Net/Vb.Net.
I am getting the error: "Operation must use an updateable query."
How can I solve this problem?
The code I am using is:
' Set Connection
Dim connectionString As String = AppSettings("connectionString")
Dim dbConnection As IDbConnection = New OleDbConnection(connectionString)
' Set Query
Dim queryString As String = "INSERT INTO [t_news] ([title_pt-PT], [title_en-GB], [text_pt-PT], [text_en-GB], [publication_date]) VALUES (@title_ptPT, @title_enGB, @text_ptPT, @text_enGB, @publication_date)"
' Set Command
Dim dbCommand As IDbCommand = New OleDbCommand
dbCommand.CommandText = queryString
dbCommand.Connection = dbConnection
' Add Parameters
With dbCommand.Parameters
.Add(New OleDbParameter("@title_ptPT", "title PT"))
.Add(New OleDbParameter("@title_enGB", "title GB"))
.Add(New OleDbParameter("@text_ptPT", "text PT"))
.Add(New OleDbParameter("@text_enGB", "text GB"))
.Add(New OleDbParameter("@publication_date", DateTime.Now.ToString("dd-MM-yyyy HH:mm:ss")))
End With
' Insert New Record
dbConnection.Open()
Try
dbCommand.ExecuteNonQuery()
Finally
dbConnection.Close()
End Try
Thank You,
Miguel
|
|
|
|
|
I have created 1 file browse btn from where i am alowing to select the file which has to be uploaded to sql server.. Now i have the Excel file path..
How do i access the file. through Open data source..
I used. sql statement
"select * into abc_data from OPENDATASOURCE('Microsoft.Jet.OLEDB.4.0','Data Source=" & vfilename & "; Extended Properties=Excel 8.0') ...[sheet1$]"
where vfilename is the Excel File Path incl filename.xls.
But it is giving error.. Can anyone help..
Thanks,
Prasanna
|
|
|
|
|
Hello guys!!
What is the minimum time (in ms) required to respond from sql server when data is near @ 1.2 GB
and also where i will get some kind of utility or sql command where i will find
1. Check the space allocated to Database
2. Check the total space remaining in database
1. Check Memory Usage of MSSQL
2. Check CPU Utilization
3. Check Disk contention
1. Use SQL Server profiler
2. Check Trace event, lock event, session event etc
3. Create Trace
1 . Check for memory utilization
2. Check for unwanted process utilizing Memory
3. Check database memory utilization
these factors
T.I.A
Shashank
|
|
|
|
|
Hello
thanks
I checked it with on BOL and got query
SELECT * FROM MASTER..SYSPROCESSES
i got it just few more things i want to clear
1) waittime
2)cpu
3)physical_io
4)memusage
what are units of these columns i.e waittime is in MS (miliseconds or else),
like that cpu?,physical_io? and memusage (i.e in MB or else)
T.I.A
shashank
|
|
|
|
|
Hi all,
I have a Date Format Problem with SQL Server 2000. the Default Date format of Sql server 2000 is MM/DD/YYYY , but i wanna DD/MM/YYYY , So how can i change the Date Format in SQL Server...
Thanx in advance
Sajjad
|
|
|
|
|
I have started storing at as text and casting it to correct date format in the stored proceedures as needed. I find that gets rid of any of the problems with dates which could go either way eg 03/04/2005.
Jon
|
|
|
|
|
SQL stores dates as binary information (assuming you used a datetime field type). The default disply format depends on the installed locale and collation order (and is likely being set by whatever UI you are using to display the dates).
For input of dates as strings, SQL Servers default is US English (mdy) order, but this can be changed with the statement 'Set DateFormat dmy' (for day, month, year order).
You can also use the convert function to convert the stored datetime values to varchar or nvarchar strings before returning the result, specifying the datetime style as a convert parameter "select mydate as convert(varchar(50),[theRealdatefieldName],103) from Mytable"
103 specifies the british dd/mm/yy format. See Sql Books Online help for Convert.
If you are looking at it in a UI (C# form), then you must either change current culture/language setting programatically or in control panel settings...
Absolute faith corrupts as absolutely as absolute power
Eric Hoffer
The opposite of the religious fanatic is not the fanatical atheist but the gentle cynic who cares not whether there is a god or not.
Eric Hoffer
|
|
|
|
|
I want to access some data from other tables while working with data from another table in one application. if I accesss data using table joins, I cant update neither table. e.g If I'am computing a pay of an employee in the Transactions table, and I want to use the basic salary field value in Employee Master table. How can I access this value and use it in the transactions processing application and update the relevant tables there after.
This approcah will enable me make sizable tables in my databaase since I will be able to reference data from various tables while working in one particular application.
I am using Visual C++ 6.0.
Thanks in advance.
|
|
|
|
|
Hi Techies,
Greetings from Joby. I am a .Net/SQL Programmer and in my new project there is an instance where I need to invoke a Java API throug a stored procedure.Can anyone please help me by giving me a clue or some piece of code to do it? I await your valuable suggestions and advices.
Thanks and Regards,
Joby.
|
|
|
|
|
I don't believe this is possible in any direct sort of way. About the best I can think of would be some kludge useing an extended SP with a C dll called by that XSp that in turn invokes the Java runtime with the desired paramters or a com dll with a com-java bridge...or maybe a kludge based on xp_cmdshell.. not fun, and likely fragile.
Absolute faith corrupts as absolutely as absolute power
Eric Hoffer
The opposite of the religious fanatic is not the fanatical atheist but the gentle cynic who cares not whether there is a god or not.
Eric Hoffer
|
|
|
|
|
anyone know how to Syncronised MySql with SQL SERVER
|
|
|
|
|
hi
Usually in Sql Database date is stored in the format of mm:dd:yyyy. I want to store it as dd:mm:yyyy. i want to make it as a permanent setting.
shelly
|
|
|
|
|
|
hi,
i want to remove identity check for a table, i used SET IDENTITY_INSERT ON but it works just for one transaction,how can i disable identity forever
(i need the Transaction for this operation)
|
|
|
|
|
Alter the table, change the identity field to an ordinary integer (remove the identity attribute). Of course you will then be responsible for computing the value for new inserts... You could set a Unique constraint on the field to insure that it still rejects duplicates.
Absolute faith corrupts as absolutely as absolute power
Eric Hoffer
The opposite of the religious fanatic is not the fanatical atheist but the gentle cynic who cares not whether there is a god or not.
Eric Hoffer
|
|
|
|
|
do you receiving error massage?
|
|
|
|
|
i'v been with crystal report last 4 years ,crystal report 8.5 version still stable than crystal report 10 version,i've scene few things that crystal report can fail
1.) once you create or call a crystal report your are not allow to change the order of columns in table that you refer for crystal report,you can add columns to table but always below other columns,cant replace the order.
note :- if you done those things you have to create or call reports again
|
|
|
|
|