Need Help Retriving Data From Sql Server 2005 With Asp.net2
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
ADVERTISEMENT
Oct 18, 2007
hello
can sql server 2005 send messages to asp.net2.0 and to inform that a user hasn't (for example) the right to read a query
how?
thanks
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
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
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
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
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
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
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
Oct 2, 2006
Hi, How do I attach an existing sql2000 database to a .net 2 project in the app_data folder? thanks
View 1 Replies
View Related
Apr 25, 2007
Hi pals.........
I have a problem that uploading a video file into the database using asp.net and sql server as database
please any one help me itzzz urgent for me............
View 1 Replies
View Related
Jul 7, 2007
I'm trying to move an application I wrote from sql2000 to sql2005. The application is in ASP.NET and works fine using SQL2000 but when I moved the database and change the connect string the page display the message:
Cannot open database "EventTracker" requested by the login. The login failed.
Login failed for user 'NT AUTHORITYANONYMOUS LOGON'.
If I add the identify tag to the web.config file
<identity impersonate="true" username="myname" password="mypasword"/>
then page comes up and everything works. The problem is I need to have the user's credentials from internet explorer to be used against the SQL database to control access.
I added some lines of code to see if the web page was acting with the web users credientials and it is for things other than the SQL2005 connections.
The following error message shows up in the web server's application log:
Event code: 3005
Event message: An unhandled exception has occurred.
Event time: 7/6/2007 6:50:10 PM
Event time (UTC): 7/7/2007 12:50:10 AM
Event ID: c3d90a99419f49ad8d307930acb5bb71
Event sequence: 13
Event occurrence: 2
Event detail code: 0
Application information:
Application domain: /LM/W3SVC/1/Root/ComputerServices/TruckerViewer-9-128282421386484375
Trust level: Full
Application Virtual Path: /ComputerServices/TruckerViewer
Application Path: c:inetpubwwwrootComputerServicesTruckerViewer
Machine name: webserver
Process information:
Process ID: 960
Process name: aspnet_wp.exe
Account name: webserverASPNET
Exception information:
Exception type: SqlException
Exception message: Cannot open database "EventTracker" requested by the login. The login failed.
Login failed for user 'NT AUTHORITYANONYMOUS LOGON'.
Request information:
Request URL: http://serverws/ComputerServices/TruckerViewer/Counters.aspx
Request path: /ComputerServices/TruckerViewer/Counters.aspx
User host address: 10.10.17.187
User: $PCAUser4
Is authenticated: True
Authentication Type: NTLM
Thread account name: webserverASPNET
Thread information:
Thread ID: 1
Thread account name: webserverASPNET
Is impersonating: False
Stack trace: at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
at System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK)
at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance)
at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance)
at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection)
at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options)
at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
at System.Data.SqlClient.SqlConnection.Open()
at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet)
at TruckerViewer.Counter1.Page_PreRender(Object sender, EventArgs e) in \webserverc$InetpubwwwrootComputerServicesTruckerViewerCounters.aspx.vb:line 61
at System.Web.UI.Control.OnPreRender(EventArgs e)
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
The SQlserver's application log records two messages;
Login failed for user 'NT AUTHORITYANONYMOUS LOGON'. [CLIENT: 10.10.94.136]
and
Login succeeded for user 'NT AUTHORITYANONYMOUS LOGON'. Connection: trusted. [CLIENT: 10.10.94.136]
This exact same code works with SQL2000 but not with SQL2005. What am I missing? Any help would be appreciated.
View 5 Replies
View Related
Dec 26, 2006
Hi,
How can i run or edit my ASP.NET 2.0/C# project in VS2005. I have source code files (including database) but it doesn't have .sln file. Please guide me how can i edit or run this in VS2005
View 3 Replies
View Related
Apr 26, 2007
Hi Pals...
I have a problem that uploading an video file into the database
using asp.net2.0 and sqlserver as database.This is urgent for me .
Please help me any one................
thanks in advance
View 10 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
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
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
Nov 5, 2007
I'm really new to the whole database deal (as well as VB.net) - specifically with the capabilities surrounding VB and SQL Server 2005. My question is open to any recommendations...
What I have is an application that a user uses to create 'new' products. They are presented a form to enter the information regarding the product they wish to create. They enter the details of the product and also locate an image that represents the product, too. Currently, this application saves the product information (including binary image data) into a SQL Server 2005 Express Edition database. This application and database reside on a client pc. What I need to do is to be able save updated and newly created product data into a file of some sort. That file will make its way to a memory stick (USB) and then be transported to a 'field' machine. Quite simply, what is the best way to do this? Are there walk-throughs on this sort of thing? The target database is also SQL Server 2005. I thought I'd post this question on here to get the best design ideas... Any help would be greatly appreciated.
~javasource
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
Jul 26, 2007
Hi,
I have a central database server that is runnning on SQL 2005 standard edition and Windows server 2003 standard as OS.
I realise that I can use SQL statements to encrypt and decrypt the data inside the standard SQL.
However, how do I read and write the data via an web application coded in C#.net and is also running on the same machine?
Another issue is, I need to replicate some of the data in this SQL standard over to a SQL mobile running on a mobile device running on Windows CE 5.0.
The mobile device also needs to read and write data to the encrypted data via a C#.net application.
Question is, with all these requirements to be met, can I use AES? I know that AES is not available on Windows XP and Windows Server 2000 and I cant find AES in the .net compact framework.
how do i go about ensuring security? how do I ensure that the symmetric key is the same both on the SQL standard and SQL mobile?
thank you.
View 7 Replies
View Related
Feb 5, 2007
is there a step by step paper to get there? here is what i need to consider. I Iwill have many customers that will need their own set of records and access pages "branded for their company" each customer will have many clients. I am hosting this application on a windows 2003 server with SQL 2005 server enterprise.
I am using windows authentication, I have created a username in windows, then i added the windows user in SQL management studio in security, granted "DB Read" and "DB write" and again under the database security tab. still from the web authentication fails. i must be nissing a step or two?
I expect to set up a username for each database as i setup new customers.
View 1 Replies
View Related
Feb 12, 2008
Hello,
I am wondering what conversion rules apply, when a string, which contains a number, is saved to a SQL Server 2005 into a column of type decimal.
This is the code I€™m using (C++):
CString cValue = "0.75"
_variant_t vtFieldValue;
vtFieldValue = _variant_t(cValue)
pRecordSet->Fields->Item["MyColumn"]->Value = vtFieldValue;
"pRecordSet" is an ADO recordset. The database column "MyColumn" is of type "decimal(19,10)".
The most important question for me is, if the regional settings of the database server or the regional settings of the client PC are considered during the conversion from the string to the decimal value. For example in standard French regional settings the "." would not be recognized as decimal separator.
I am also wondering if the language of the database instance, in which this data is saved, is considered during this conversion or any other settings of this database instance.
So my general question is: Does anybody know exactly what rules apply during the above mentioned conversion?
Thank you for your help.
Regards,
Volker
View 2 Replies
View Related