Retriving Data From Table In SQL CE
May 28, 2008
Hi
I am trying to retrive data from table store in .sdf database file
but not able to do it.
where i will use select * from xyz in project. I am developing it on desktop
using vc++ 2005 in SQL server compact edition.
am using
hr = pICmdText->Execute(NULL, IID_NULL, param, NULL, NULL);
It is not easy for me to see data of table from sdf file
so plz reply
View 9 Replies
ADVERTISEMENT
Aug 9, 2006
Baby writes "how to retrive data from four table
four tables have same column number and name
i am trying to retrive one column data from all the table
i am trying these :- to get the result
select mutual_fund.customer_id,insurance.customer_id,fixed_dep.customer_id,home_loan.customer_id from mutual_fund,insurance,fixed_dep,home_loan where (mutual_fund.customer_id=fixed_dep.customer_id and mutual_fund.customer_id=home_loan.customer_id and fixed_dep.customer_id=home_loan.customer_id) or (mutual_fund.customer_id=fixed_dep.customer_id and mutual_fund.customer_id=insurance.customer_id and fixed_dep.customer_id=insurance.customer_id) or (mutual_fund.customer_id=home_loan.customer_id and mutual_fund.customer_id=insurance.customer_id and home_loan.customer_id=insurance.customer_id) or (fixed_dep.customer_id=home_loan.customer_id and fixed_dep.customer_id=insurance.customer_id and home_loan.customer_id=insurance.customer_id)
the comparision working in the query
please help me tell me how to solve my problem"
View 1 Replies
View Related
Mar 26, 2005
every time i try to get data of a student stored in SQL server 2000 in the student table it gives me an error
Login failed for user '???????????ASPNET'
Exception Details: System.Data.SqlClient.SqlException: Login failed for user '??????????ASPNET'.
works fine normally its only when i try to reteive actuall data stored on the server. theres obviously something wrong the server side.
help help help
View 2 Replies
View Related
May 16, 2008
Hello,
I need some help on this.
I want to retrieve all the duplicate records from a particulat column.
For eg suppose i have a table named testtable
columns in the table : item_id,ref_no,title,address
now i need to check if there are any duplicate entries in the ref_no column and if there are any retrieve the records.
Gaurish Salunke
Software Developer
OPSPL
View 4 Replies
View Related
Dec 13, 2006
Hi Every one
I m using FCKeditor in my web application and my requirement is to create and edit documents in FCKeditor.
The problem is in storing the data. it is not storing the data in the DB. its only stors some html code but it is incomplete.
Please some one Solve this problem
View 1 Replies
View Related
Aug 9, 2007
i have a textbox which a user enters a numeric value
i want it to use SqlDataSource and check if the value exists in any of the tables.
in my text box the users would enter starting from '100000' or '200000'
i want it to check the view that starts the # with '100000' and 2ed view starts '200000'
With this i can check in one of the tables and make the selection.
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:imacstestConnectionString %>"
SelectCommand="SELECT [ReportNumber] FROM [AppraisalSummaryBlue] WHERE ([ReportNumber] = @ReportNumber)">
<SelectParameters>
<asp:ControlParameter ControlID="txtReport" Name="ReportNumber" PropertyName="Text"
Type="String" />
</SelectParameters>
</asp:SqlDataSource>
How can i make this possible ?
i was thinking putting a second sqldatasource and have that check the second view but how can i make the textbox goto the correct selectcommand ?
View 1 Replies
View Related
Dec 6, 2004
I have a text column in my db which stores more than 8000 characters. When I retrieve the values from the column in query analyzer (I have set the output buffer to 8000), it only shows me first 8000 chars only. How do I display all the text from the text field?
View 2 Replies
View Related
Apr 3, 2007
hi guys i am new to asp.net
i have been using asp2.net (c#) to retrive infomation from my sql server 2005 database
the connection infomation is within the web.config
now i need to retreive an infomation from the sql server 2005 database instread of the whole thing
example:
select name from student where nric = 'asd'
(only 1 result shld come out)
could anyone show me the general coding of what i should do to make a variable store one targeted result of the database please?
View 1 Replies
View Related
Nov 28, 2007
Hi
While trying to run a query from SQLServer 2005 on linked server (Oracle 10G) using Open query, I receive followin error message:
Msg 7346, Level 16, State 2, Line 1
Cannot get the data of the row from the OLE DB provider "OraOLEDB.Oracle" for linked server "EDWORA".
It runs for some hours before giving the mentioned error.
My query is something like :
select * from openquery (EDWORA, 'select * from Tablex')
Any idea how can I solve this issue?
Regards
Elham
View 4 Replies
View Related
Dec 28, 2007
Hi,
Im using many source tables in a dataflow from which data has to be union in to a single table.While doing this i have to pull the table names in to the destination table.How to get the table names as column values?
View 2 Replies
View Related
Aug 1, 2001
Is it possible for retriving data from a remote Sql server database and storing it in a local sqlserver database.
View 1 Replies
View Related
Oct 7, 2007
hi all,
i have a deployed on the report server. is there any way i can retrive the metadata(xml) from report server using C#.
Also wanted to run the reoprt from server and get it's output (data) in XML.
please help.
Regards...
girija shankar
View 1 Replies
View Related
Jan 22, 2008
Hello,
I am using datareader to retrive the varchar (max) value from the database. But it is reteriving only 8000 why ? I am not using normal varchar datatype.
Below is the sample code.
Convert.ToString(_oDr["MyVar"])
where _oDr is the datareader
MyVar is defined of type varchar (max) in the sql 2005 database.
Any help will be appreciated.
View 3 Replies
View Related
Apr 23, 2006
I would appreciate help with retriving the ID of the last record inserted. Have spent considerable time in forums and google but can't find anything that works for me.
Here is my VB Code
Dim queryString As String = "INSERT INTO [DUALML] ([UseriD], [Company]) VALUES (@UseriD, @Company)" Dim dbCommand As System.Data.IDbCommand = New System.Data.SqlClient.SqlCommand dbCommand.CommandText = queryString dbCommand.Connection = dbConnection
Dim dbParam_useriD As System.Data.IDataParameter = New System.Data.SqlClient.SqlParameter dbParam_useriD.ParameterName = "@UseriD" dbParam_useriD.Value = useriD dbParam_useriD.DbType = System.Data.DbType.Int32 dbCommand.Parameters.Add(dbParam_useriD) Dim dbParam_company As System.Data.IDataParameter = New System.Data.SqlClient.SqlParameter dbParam_company.ParameterName = "@Company" dbParam_company.Value = company dbParam_company.DbType = System.Data.DbType.[String] dbCommand.Parameters.Add(dbParam_company)
Dim rowsAffected As Integer = 0 dbConnection.Open Try rowsAffected = dbCommand.ExecuteNonQuery Finally dbConnection.Close End Try
Return rowsAffected End Function
View 4 Replies
View Related
Aug 5, 2004
Hi All.
Is there a way to retrieve the position of a word, phrase or sign in a field?
For example, Field content is ABCDEFG1239/1002STJ
I would like to get the exact position of / which will be position 12.
Thank you.
Best regards
View 5 Replies
View Related
Apr 27, 2006
I try to retrive an xml portion (<points><point><x>1</x></point></points>) stored in a varchar(max) column, this is my code dr = cmd.ExecuteReader();
_xmlFile = dr.GetSqlString(dr.GetOrdinal("XmlJoin")).ToString();
Label1.Text = _xmlFile; and this is what I get "12"Maybe I missed something to get the whole XML String
View 3 Replies
View Related
May 25, 2001
Hi,
I am tring to figure out how to retrieve the value of a global variable from s SQL task, the value for the Global variable is set in a Active Script Task. Any help is greatly appreciated.
Thanks,
Satish.
View 1 Replies
View Related
Jul 15, 2003
Hi,
Can any one suggest me how to retrieve most recent job from msdb..sysjobhistory table?
I want to supply the job name which has more than 1 steps. Step 1 or more is already completed ( success/failure) and in the last step I am trying to retrieve sysjobhistory.messages(success/failure) stored in the sysjobhistory table for the steps already executed.
I want the records related with last/current job executed.
Thanks.
View 4 Replies
View Related
Aug 2, 2007
Hi friends
I have a bit problem here
Just I want to get back all deleted record of database
How do I perform this task?
If It is possible then plz help me out?
Thanks in Advance
Khan
View 4 Replies
View Related
Jan 28, 2008
Hi Guys.
i have write a store procedure which take few input and then backup the database and at the same time it's restore the database with new name, but i m hving a error code.
what this program do in restore section, it's read the backup file and all give me list of all the file with the location and then i can rename them.
actually the purpose of doing this is to create a new database on behalf of old database. plz have alook code
PLZ, PLZ help me, it's really geting headach
USE [master]
GO
/****** Object: StoredProcedure [dbo].[CreateNewDB] Script Date: 01/28/2008 17:13:09 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER proc [dbo].[CreateNewDB]
@ActualDb varchar(128),
@dbname sysname ,
@recipients varchar(128)
AS
SET NOCOUNT ON
Declare @cmd sysname ,
@filename varchar(128) ,
@Backuppath varchar(1000),
@LogicalName varchar(2000),
@ActualPath varchar(2000),
@Aloop int,
@FileID int,
@sql nvarchar(4000)
SET @Backuppath = 'C:' + @dbname
-- TAKE BACKUP
BACKUP DATABASE @ActualDb TO DISK = @Backuppath WITH NOFORMAT, INIT, NAME = 'DBBackup-Full Database Backup', SKIP, NOREWIND, NOUNLOAD, STATS = 10
-- Get files in backup
select @cmd = 'restore filelistonly from disk = ''' + @Backuppath + ''''
CREATE table #RestoreFileListOnly
(
LogicalName sysname,
PhysicalName sysname,
type char(1),
FileGroupName sysname,
[size] bigint,
[MaxSize] bigint,
FileID int
)
INSERT into #RestoreFileListOnly
exec(@cmd)
-- buld the restore command
set @Aloop=1
set @FileID=0
set @sql= ''
set @sql = @sql + 'RESTORE DATABASE ' + @dbname + CHAR(10)
set @sql = @sql + ' FROM DISK = ''' + @Backuppath + '''' + CHAR(10)
set @sql= @sql + ' WITH FILE = 1' + CHAR(10)
WHILE (@aloop <= @@ROWCOUNT)
BEGIN
SELECT @LogicalName = LogicalName , @FileID = FileID, @ActualPath = Left(PhysicalName, len(PhysicalName)-charindex('',reverse(PhysicalName))+1) FROM #RestoreFileListOnly WHERE FILEID > @FileID
SET @sql= @sql + ',' + CHAR(10)
SET @sql= @sql + CHAR(9) + 'MOVE''' + @LogicalName + '''TO''' + @ActualPath + '''' + @dbname + ''''
-- @sql= @sql + 'MOVE '''+ + '' TO N'C:Program FilesMicrosoft SQL ServerMSSQL.2MSSQLDATAMALIK.mdf'
SET @Aloop=@Aloop+1
END
SET @sql = @sql + ', NOUNLOAD, STATS = 10'
-- Restore the database
print @sql
EXEC (@sql)
Drop table #RestoreFileListOnly
-- send email to the define person.
EXEC master..xp_sendmail @subject = @cmd, @recipients = @recipients, @message = @@servername
ERROR:
Msg 213, Level 16, State 7, Line 1
Insert Error: Column name or number of supplied values does not match table definition.
Msg 3013, Level 16, State 1, Line 1
RESTORE FILELIST is terminating abnormally.
View 5 Replies
View Related
Sep 4, 2007
private void Page_Load(object sender, System.EventArgs e){ // Put user code to initialize the page here MemoryStream stream = new MemoryStream (); SqlConnection connection = new SqlConnection (@"..."); try { connection.Open (); SqlCommand command = new SqlCommand ("select Picture from Image", connection); byte[] image = (byte[]) command.ExecuteScalar (); stream.Write (image, 0, image.Length); Bitmap bitmap = new Bitmap (stream); Response.ContentType = "image/gif"; bitmap.Save (Response.OutputStream, ImageFormat.Gif); } finally { connection.Close (); stream.Close (); }
Error: byte[] image = (byte[]) command.ExecuteScalar ();
Unable to cast object of type 'System.Int32' to type 'System.Byte[]'.
View 1 Replies
View Related
Mar 10, 2006
i am storing gender in the database.i want to retrive it in one of the radiobuttons for male and female already present on the form . how can i?
View 1 Replies
View Related
May 20, 2008
Dear Friends,
Hi I am having a problem while showing Products from SQL
Server database. Exactly I have a table named Products which has some Products
posted by admin I want to show some latest Products on my default page
based on DateTime which are displayed like show last week articles,show last two weeks articles etc on button click I written my SQL query like: searchquery = "select * from Prducts where Date between '" + System.DateTime.Now.AddDays(-7).ToShortDateString() + "' and '" + System.DateTime.Now.AddDays(-1).AddHours(23).AddMinutes(59).AddSeconds(29).ToShortDateString() + "'"; If any body knows plz help me
View 3 Replies
View Related
Jan 10, 2006
Hi, Assume I have a table name "myTime". This table is simply only have 1 (one) DATETIME field "MyTestTime" (also serve as a primary number).Table MyTime- MyTestTime : SQLTYPE DATETIMETo insert a new row into this field, I simply wrote :SqlCommand sqlCommand = new SqlCommand("insert into MyTime values('2006-01-09')", sqlConnection);
I got the value of "2006-01-09" from a textbox or other relevan control.I realize when I try to use "SELECT * FROM MyTime" statement, MSSQL server 2000 automatically convert my date value from "2006-01-09" to "01/09/2006" (from YYYY-MM-DD to MM/DD/YYYY). I don't know why this one must be converted to MM/DD/YYYY automatically (I believe this behavior is depend on some "setting option" in my MSSQL server - but I don't know which one).The challenge is :In my country, the actual date format is like German Date format (DD-MM-YYY). Well I know this is only "Customization" problem. But how insert datetime value given from sql query to a datetime variable?// Connect to database, make a query, get the datareader result, and bla bla blaDateTime aDateTime = new DateTime;aDateTime = Convert.ToDateTime(myDataReader["PostDate"].ToString());// close connectionMy question isHow can I make sure that aDateTime's day is 09 not 01. How my program know that 09 is day not month. I can't use string.split() method because it's possible that my database setting will change from "mm-dd-yyyy" to "dd-mm-yyyy"thanks
View 4 Replies
View Related
Sep 20, 2007
I am attempting to create a stored procedure that will launch at report runtime to summarize data in a table into a table that will reflect period data using an array type field. I know how to execute one line but I am not sure how to run the script so that it not only summarizes the data below but also creates and drops the table.
Any help would be greatly appreciated.
Current Table
Project | Task | Category | Fiscal Year | Fiscal Month | Total Hours
---------------------------------------------------------------------------------------------------------
Proj 1 | Task 1 | Cat 1 | 2007 | 01 | 40
Proj 1 | Task 1 | Cat 2 | 2007 | 02 | 20
Proj 1 | Task 1 | Cat 3 | 2007 | 03 | 35
Proj 1 | Task 1 | Cat 1 | 2008 | 01 | 40
Proj 1 | Task 1 | Cat 2 | 2008 | 02 | 40
Proj 1 | Task 1 | Cat 3 | 2008 | 03 | 40
Proposed Table
Project | Task | Category | Fiscal Month 01 | Fiscal Month 02 | Fiscal Month 03 | Fiscal Year
---------------------------------------------------------------------------------------------------------------------------------------------------
Proj 1 | Task 1 | Cat 1 | 40 | 0 | 0 | 2007
Proj 1 | Task 1 | Cat 2 | 0 | 20 | 0 | 2007Proj 1 | Task 1 | Cat 3 | 0 | 0 | 35 | 2007
Proj 1 | Task 1 | Cat 1 | 40 | 0 | 0 | 2008
Proj 1 | Task 1 | Cat 2 | 0 | 40 | 0 | 2008
Proj 1 | Task 1 | Cat 3 | 0 | 0 | 40 | 2008
Thanks,
Mike Misera
View 6 Replies
View Related
Aug 18, 2015
How to purge data in transaction table or we can delete some data and store in separate table in data warehouse?
View 7 Replies
View Related
Mar 30, 2008
Dear All
I have a table with the following structure in sql server 2005
create table app(
sno int,
name varchar(50),
add varchar(50),
city varchar(50),
state varchar(50)
)
it contains the follwing data
------------------------------------------
sno name add city state
------------------------------------------
1 mark street no1 newcity newstate
2 mark street no1 newcity newstate
3 mark street no1 newcity newstate
4 mark street no1 newcity newstate
5 mark street no1 newcity newstate
6 mark street no1 newcity newstate
7 mark street no1 newcity newstate
8 mark street no1 newcity newstate
9 mark street no1 newcity newstate
10 mark street no1 newcity newstate
11 mark street no1 newcity newstate
12 mark street no1 newcity newstate
13 mark street no1 newcity newstate
14 mark street no1 newcity newstate
15 mark street no1 newcity newstate
16 mark street no1 newcity newstate
17 mark street no1 newcity newstate
18 mark street no1 newcity newstate
19 mark street no1 newcity newstate
20 mark street no1 newcity newstate
----------------------------------------
I want to retrive previous 5 records, next 5 records and the record that meet the where condition of a select query.
When I run
select sno,add,name,city,state from app where sno=7
I want the following result
------------------------------------------
sno name add city state
------------------------------------------
2 mark street no1 newcity newstate |
3 mark street no1 newcity newstate |
4 mark street no1 newcity newstate | -- previous 5 records
5 mark street no1 newcity newstate |
6 mark street no1 newcity newstate |
7 mark street no1 newcity newstate --- searched record
8 mark street no1 newcity newstate |
9 mark street no1 newcity newstate |
10 mark street no1 newcity newstate |--- next 5 records
11 mark street no1 newcity newstate |
12 mark street no1 newcity newstate |
----------------------------------------
if there is a method to get the above result set, kindly post the query.
View 14 Replies
View Related
Jan 26, 2006
Just wondering if there is an easy transact statement to copy table 1 to table 2, appending the data in table 2.with SQL2000, thanks.
View 2 Replies
View Related
May 3, 2004
Hello all,
Please help....
I have a text file which needs to be created into a table (let's call it DataFile table). For now I'm just doing the manual DTS to import the txt into SQL server to create the table, which works. But here's my problem....
I need to extract data from DataFile table, here's my query:
select * from dbo.DataFile
where DF_SC_Case_Nbr not like '0000%';
Then I need to create a new table for the extracted data, let's call it ExtractedDataFile. But I don't know how to create a new table and insert the data I selected above into the new one.
Also, can the extraction and the creation of new table be done in just one stored procedure? or is there any other way of doing all this (including the importation of the text file)?
Any help would be highly appreciated.
Thanks in advance.
View 3 Replies
View Related
Apr 20, 2003
I'm not sure if this could be done, but if anyone has any insight on how to do this please let me know...
Currently, I have a table that has a field of Categories. I recently created a Category table in which each category has it's own ID. I need to replace the Data that was in my original table with the new ID's based on the actual category name... Is there any way of doing this without manaul data entry?
View 2 Replies
View Related
Apr 20, 2003
I'm not sure if this could be done, but if anyone has any insight on how to do this please let me know...
Currently, I have a table that has a field of Categories. I recently created a Category table in which each category has it's own ID. I need to replace the Data that was in my original table with the new ID's based on the actual category name... Is there any way of doing this without manaul data entry?
View 2 Replies
View Related
Oct 26, 2005
Hi AllWonder if you could help, I have a bog standard table called STOCKPRICESthat has served me well for a while, but now I need to change the structureof it and because a number of users have used it in it's present form I needto so the following in SQL script:a) Grab a snapshot of the current SQL data.b) Re-structure the STOCKPRICES table.c) Post this grabbed data back, but in the new format.My script plan was to firstly to rename the current STOCKPRICES table toSTOCKPRICESOLD (you can do this can't you), create a new STOCKPRICES tablein the new format and then somehow extract the data from STOCKPRICESOLD andsquirt it into STOCKPRICES.The current schema for STOCKPRICES is as follows:# --------------------------------------------------# Table structure for table 'STOCKPRICES'# --------------------------------------------------DROP TABLE IF EXISTS `STOCKPRICES`;CREATE TABLE `STOCKPRICES` (`STOCKID` VARCHAR(30),`CURRENCYID` VARCHAR(30),`HDNETAMOUNT` DECIMAL(10,3) DEFAULT 0,`HDTAXAMOUNT` DECIMAL(10,3) DEFAULT 0,`RRPNETAMOUNT` DECIMAL(10,3) DEFAULT 0,`RRPTAXAMOUNT` DECIMAL(10,3) DEFAULT 0,`NETAMOUNT` DECIMAL(10,3) DEFAULT 0,`TAXAMOUNT` DECIMAL(10,3) DEFAULT 0,INDEX `indxCUURENCYID` (`CURRENCYID`),INDEX `indxSTOCKID` (`STOCKID`));Like I said it's very basic.My new table wants to be like the following:# --------------------------------------------------# Table structure for NEW table 'STOCKPRICES'# --------------------------------------------------DROP TABLE IF EXISTS `STOCKPRICES`;CREATE TABLE `STOCKPRICES` (`STOCKID` VARCHAR(30),`CURRENCYID` VARCHAR(30),`PRICELEVELID` VARCHAR(30),`NETAMOUNT` DECIMAL(10,3) DEFAULT 0,`TAXAMOUNT` DECIMAL(10,3) DEFAULT 0,INDEX `indxPRICELEVELID` (`PRICELEVELID`),INDEX `indxCUURENCYID` (`CURRENCYID`),INDEX `indxSTOCKID` (`STOCKID`));The new re-structure means that PRICELEVELID will include a unique referenceto the HD, RRP, standard prices (plus 3 others that I'm going to create).I know this probably very simple data architecture to you guys, but I'm sureyou can appreciate why I need to change the structure to this method so thatI'm not creating redundant data fields if the user only enters a standardprice I won't be storing nothing for the 2 x HD and 2 x RRP price fields.I don't think I've got a problem renaming the old one and re-creating thenew one, but how do I get the data from one to another?My problem is that I have:code, currency, hdnet, hdtax, rrpnet, rrptax, net, taxIVP GBP 2.00 0.35 200.00 35.00 100.00 17.50etc...and I need to get it into the format:code, currency, pricelevelid, net, taxIVP GBP hd 2.00 0.35IVP GBP rrp 200.00 35.00IVP GBP standard 100.00 17.50etc...Any ideas?RgdsLaphan
View 4 Replies
View Related
Sep 9, 2005
I have a column defined as smalldatetime. Default length (4), and "allow NULLS" is checked.In the Enterprise Manager UI, when i enter data into that table row, if i just tab past that column, all is well, and the value is represented in the UI as <NULL>.The problem comes once i ever enter a date into that column. Say i have entered a date (all is well), and now i want to remove that entry and go back to NULL (after the date value has been committed, different entry session, say).How is that done?It seems to me, once a date has ever been entered into that column, now, if i try to remove it, i get the error "The value you entered is not consistant with the data type or length of the column, or over grid buffer limit". I have tried deleting the value, entering spaces, entering the string NULL or the string <NULL>; maybe some other tries as well, but none works, i always get that error message and am not allowed to proceed past that cell until i restore a date value to it. I want to get back to <NULL>.Anybody know?Thank you.Tom
View 1 Replies
View Related