SqlDataReader dr=cmd.ExecuteReader(); ------------->>>> Here iam getting Following Error.
while(dr.Read())
{ Response.Write(dr["ID"].ToString());
}
}
}
catch(System.Exception ex)
{
Response.Write(ex);
}
Error:
System.InvalidCastException: Object must implement IConvertible. at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream) at System.Data.SqlClient.SqlCommand.ExecuteReader() at MIS.UI.ResourceList.DDLProductLine_SelectedIndexChanged(Object sender, EventArgs e) in c:inetpubwwwrootdotnet pgmsmisui
esourcelist.aspx.cs:line 121
Hello, The problem which i am facing in SQL Server 2005 is that, I have 2 database and the owner of both the databases is sa but when I go to database > security > users here I cannot find 'sa' as user. when I am going to add that user I get following error : cannot use special principal 'sa'
also when I connect sa on other computer I will not connect
I have already checked following thing : The Authontication mode of SQL is mixed mode database owner is also sa sa is also enable
Trying to update my local developer version of SQL Server 2005 SP1 to SP2. The setup program terminates with the following information dumped from the logs. Not sure if it is related, but I recently installed the SQL Server 2005 Compact Edition (tools, runtime, etc) on the same development machine. It is a little too deep for me to figure out
Darryl
Here are the last few lines of the HotFix.Log
04/24/2007 14:46:48.374 MSP Error: 29527 The setup has encountered an unexpected error in datastore. The action is RestoreSetupParams. The error is : Source File Name: datastorecachedpropertycollection.cpp
Compiler Timestamp: Wed Jun 14 16:27:59 2006
Function Name: CachedPropertyCollection::findProperty
04/24/2007 14:46:48.822 The following exception occurred: Unable to install Windows Installer MSP file Date: 04/24/2007 14:46:48.822 File: depotsqlvaultstablesetupmainl1setupsqlsesqlsedllcopyengine.cpp Line: 800
Now the SQL9_Hotfix_KB921896_sqlrun_sql.msp.log shows this as the last few lines
MSI (s) (A4:38) [14:46:48:630]: Product: Microsoft SQL Server 2005 - Update 'Service Pack 2 for SQL Server Database Services 2005 ENU (KB921896)' could not be installed. Error code 1603. Additional information is available in the log file C:Program FilesMicrosoft SQL Server90Setup BootstrapLOGHotfixSQL9_Hotfix_KB921896_sqlrun_sql.msp.log.
MSI (s) (A4:38) [14:46:48:630]: Note: 1: 1729 MSI (s) (A4:38) [14:46:48:630]: Transforming table Error.
MSI (s) (A4:38) [14:46:48:630]: Note: 1: 2262 2: Error 3: -2147287038 MSI (s) (A4:38) [14:46:48:646]: Transforming table Error.
MSI (s) (A4:38) [14:46:48:646]: Transforming table Error.
MSI (s) (A4:38) [14:46:48:646]: Note: 1: 2262 2: Error 3: -2147287038 MSI (s) (A4:38) [14:46:48:646]: Transforming table Error.
MSI (s) (A4:38) [14:46:48:646]: Note: 1: 2262 2: Error 3: -2147287038 MSI (s) (A4:38) [14:46:48:646]: Transforming table Error.
MSI (s) (A4:38) [14:46:48:646]: Note: 1: 2262 2: Error 3: -2147287038 MSI (s) (A4:38) [14:46:48:646]: Transforming table Error.
MSI (s) (A4:38) [14:46:48:646]: Note: 1: 2262 2: Error 3: -2147287038 MSI (s) (A4:38) [14:46:48:662]: Transforming table Error.
MSI (s) (A4:38) [14:46:48:678]: Transforming table Error.
MSI (s) (A4:38) [14:46:48:678]: Note: 1: 2262 2: Error 3: -2147287038 MSI (s) (A4:38) [14:46:48:678]: Transforming table Error.
MSI (s) (A4:38) [14:46:48:678]: Note: 1: 2262 2: Error 3: -2147287038 MSI (s) (A4:38) [14:46:48:678]: Transforming table Error.
MSI (s) (A4:38) [14:46:48:678]: Note: 1: 2262 2: Error 3: -2147287038 MSI (s) (A4:38) [14:46:48:678]: Product: Microsoft SQL Server 2005 -- Configuration failed.
MSI (s) (A4:38) [14:46:48:678]: Attempting to delete file c:WINDOWSInstaller6749ee3.msp MSI (s) (A4:38) [14:46:48:678]: Unable to delete the file. LastError = 32 MSI (s) (A4:38) [14:46:48:694]: Cleaning up uninstalled install packages, if any exist MSI (s) (A4:38) [14:46:48:694]: MainEngineThread is returning 1603 MSI (s) (A4:2C) [14:46:48:694]: Destroying RemoteAPI object. MSI (s) (A4:04) [14:46:48:694]: Custom Action Manager thread ending. === Logging stopped: 4/24/2007 14:46:48 === MSI (c) (58:E4) [14:46:48:694]: Decrementing counter to disable shutdown. If counter >= 0, shutdown will be denied. Counter after decrement: -1 MSI (c) (58:E4) [14:46:48:694]: MainEngineThread is returning 1603 === Verbose logging stopped: 4/24/2007 14:46:48 ===
Time: 04/24/2007 14:46:48.854 KB Number: KB921896 Machine: DUTTONDARRYL1 OS Version: Microsoft Windows XP Professional Service Pack 2 (Build 2600) Package Language: 1033 (ENU) Package Platform: x86 Package SP Level: 2 Package Version: 3042 Command-line parameters specified: Cluster Installation: No
********************************************************************************** Prerequisites Check & Status SQLSupport: Failed
********************************************************************************** Products Detected Language Level Patch Level Platform Edition Database Services (MSSQLSERVER) ENU SP1 2005.090.2047.00 x86 DEVELOPER Analysis Services (MSSQLSERVER) ENU SP1 2005.090.2047.00 x86 DEVELOPER Reporting Services (MSSQLSERVER) ENU SP1 9.00.2047.00 x86 DEVELOPER Notification Services ENU SP1 9.00.2047.00 x86 DEVELOPER Integration Services ENU SP1 9.00.2047.00 x86 DEVELOPER SQL Server Native Client ENU 9.00.2047.00 x86 Client Components ENU SP1 9.1.2047 x86 DEVELOPER MSXML 6.0 Parser ENU 6.00.3890.0 x86 SQLXML4 ENU 9.00.2047.00 x86 Backward Compatibility ENU 8.05.1704 x86 Microsoft SQL Server VSS Writer ENU 9.00.2047.00 x86
what the program will do if we caught that exception .. i need some suggestions ... i got this exception(String or binary data would be truncated. The statement has been terminated.).. will it affect the functionality of the program...
Hi everyone,Is there a system stored procedure or another way that I can retrievethe current date and time of the SQL Server computer?Any info would be appreciated...Thanks in advance,Dan
I would like to get the primary key values in a DML CREATE TRIGGER as follows: CustomerID = 12 AND InvoiceID = 50 I create the DML trigger for UPDATE and DELETE only, how do I retrieve the values as above ? Jon Galloway provided a sample in http://weblogs.asp.net/jgalloway/archive/2008/01.aspx but the Primary Key Field and Primary Key Value were inserted into separate columns while I need to combine the Primary Key Field and Primary Key Value into 1 single field, using his example, I want to form the primary key as: ScoreId = 423 ScoreId = 3064 etc. Note that his example only show a single primary key in a table whereas I need to handle multiple primary keys in a table.
I am new to T-SQL programming. I need to write a main procedures to execute multiple transactions. How could I structure the program so that each transaction will not abort if failed. Instead, the next transaction will keep running. At the very end the procedure will output the error and report them back to the main program in the output parameters. Looking for pseudo code.
I am trying to install SQL Server 2000 on a Win2K OS machine but Iget this error message:"A previous program installation created pending file operations onthe installation machine. You must restart the computer before runningsetup."I see others have had this problem but have fixed it using the solutionin:http://support.microsoft.com/defaul...kb;en-us;312995I have tried the solution but to no avail. The registry key:HKEY_LOCAL_MACHINESYSTEMCurrentControlSetContro lSessionManagerPendingFileRenameOperations keeps reappearing as soon as Iclose RegEdit.Any ideas?Thanks,lq
i have a program which should give the out like this XAPIALTMKT20010829105525.TXT
but its giving the output = 'X' which is just the first initial...how can i get this...
if i don't write the @filename=.... only then its giving the output..but i want to store it in the varable..how can i do that ================================ declare @v datetime , @filename varchar
It is very interesting to me that most people in this group can't do simpleSQL. Are you viewing MySQL as a simple file system?As long as you do that,you willnot understand SQL in any dialect. So from now on:When you have a question about SQL. post the table structures. Uh, "WithCreate".Post some sample data in the form of INSERTS.Regards,Rich--The journey is the reward.
I am trying to send an email from a cmd prompt from SQL Server 2005 server using mailsend program. I am getting the message "Could not send mail". I am really stumped, don't know how to fix it. Any suggesstions?
I have installed SQL Server 2005 and created a job. I made the job failed to test the mailsend program. The notification step that uses the mailsend succeeded but I did not get an email. I am using mailsend program on SQL Server 2000 and it works fine. I am really stomped and don't know what to do to fix it?
tblHIT - this table will reveive record every minutes Date | Time | Main_ID | Hit ------------------------------------ 3/1/2006 | 100 | 200 | 8700 ... ... ... 4/14/2008 | 100 | 200 | 4500 4/14/2008 | 100 | 201 | 8700 4/14/2008 | 200 | 200 | 3500 4/14/2008 | 300 | 201 | 7700 ... ...
I've also 1 job in SQL Server Agent will execute STORED PROCEDURE and will filter 7 days record before from current date and insert it into tblHIT_7days. tblHIT_7days shown as follow tblHIT_7days Date | Time | Main_ID | Hit ------------------------------------ 3/7/2008 | 100 | 200 | 8700 ... ... ... 4/13/2008 | 100 | 200 | 4500 4/13/2008 | 100 | 201 | 8700 4/13/2008 | 200 | 200 | 3500 4/13/2008 | 300 | 201 | 7700
I've plan to create TRIGGER. This TRIGGER will insert the appropriate record from tblHIT into tblHIT_7days and also delete a appropriate record in tblHIT_7days. This INSERT and DELETE transaction depend on current date.
I am about to build a program that will require the use of DB. In the pass I used Access as my back end, but this time I would like to use Sql Server. I just have a few questions before I begin.
1. After deploying and installing my program, do I need to have sql server installed on users system or can the DB file exist on its own and just use ADO.NET to access the file? (As I done in the pass to access my Access mdb file)
2. If I can deploy a sql file -- can it be done with Sql Server Express?
3. If it can't be done, what db program should I use?
On some occasions when trying to send data back to the server, the program will lock up for up to 30 minutes. The code below is the rda data transfer process and the function IsConnected() determines whether there is a connection.
If Not MainFrm.IsConnected Then rda.ConnectionManager = True End If If MainFrm.IsConnected Then Dim sCon As String = "Provider=SQLOLEDB;Data Source=175.21.21.121;Initial Catalog=OurDb;User ID=UserId;Password=pwd" rda.InternetUrl = "http://Ourwebsite.co.uk/tfr/sqlcesa30.dll" rda.LocalConnectionString = "Data Source=Program FilesSysdata.sdf" For i As Integer = 0 To RecCount - 1 Try rda.SubmitSql(UpdateRec(i, 0), sCon) Catch Ex As SqlCeException ErrTxt = Ex.ToString End Try Next
Public Shared Function IsConnected() As Boolean Dim request As HttpWebRequest Dim response As HttpWebResponse Try request = CType(WebRequest.Create("http://www.intel.com/"), HttpWebRequest) response = CType(request.GetResponse(), HttpWebResponse) If response.StatusCode = HttpStatusCode.OK Then response.Close() Return True Else response.Close() Return False End If Catch Ex As WebException Return False End Try End Function
There are rda properties which determine a timeout. How can I use these to stop my program from locking up if the signal is weak?
I have sql server 2005 (full version) installed on my local machine, while the databases (on the server) I want to program against are in sql 2000. Could I program against sql 2000 databases using sql 2005? If yes, what do I need to know before I start doing that? Any suggestions are welcome.
I have written this Program For Updating the profile Information .At the Page_Load Event I read the profile information from the database and write it in the respective Textboxes .At the Button_Click event I have written a program to Update the data from the respective Textboxes.The program executes but doesnot updates .public partial class CreateProfile : System.Web.UI.Page{ SqlConnection con; SqlCommand com; string un = HttpContext.Current.User.Identity.Name; protected void Page_Load(object sender, EventArgs e) { con = new SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Profiledata.mdf;Integrated Security=True;User Instance=True"); com = new SqlCommand("select * from profiletable where username='" + un + "' ", con); DataSet ds = new DataSet(); SqlDataAdapter da = new SqlDataAdapter(com); SqlCommandBuilder cb = new SqlCommandBuilder(da); DataTable dt = new DataTable(); da.Fill(ds); dt = ds.Tables[0]; Textname.Text = dt.Rows[0][1].ToString(); com.Cancel(); } protected void Button2_Click(object sender, EventArgs e) { con = new SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Profiledata.mdf;Integrated Security=True;User Instance=True"); con.Open(); com = new SqlCommand("update profiletable set name='" + Textname.Text + "' where username='" + un + "' ", con); com.ExecuteNonQuery(); com.Cancel(); con.Close(); }} Plz help me with this program........................
I need to create a program that will run Client Access to download data from the AS400 to a flat file, then run SQL DTS to import the data into a table for use by another software package.
I've created a bat file that does that using the CA RTOPCB command and the SQL DTSRUN utility. Problem is that it appears that I need to first check to see if there is a table in SQL and if there is to delete it. Otherwise, rather than overlay the existing data in the table it adds to it.
Is there a way to issue a SQL drop table in DOS? Or am I missing something that could be done in SQL?
The DTSRUN is using a local package and CA is using a transaction request.
does anyone know of tools that allow free format screen design, easily programmable data validation and prgramming for use with SQL. I am used to using 4GL languages and want to avoid low level programming. For example to fifind a record and display the details i am used to a line of code that would allow the data field to do the find on to be entered and the next line of code would say find fieldname using index name and the results displayed please say yes !!!
I have this Visual Basic program that if you are already logged into the application, the program get the username and password automatically to run the program. If the user runs the program not logged into the application, the program prompts username and password.
I need to know the T-SQL statement that will get the username and password when the user is already logged into the application. Basically I have the username part but the password keeps coming back as NULL and will not allow program to run.
They have provided search string examples like 'Microsoft, DBA, CA' or 'CA' or 'Microsoft, developer' or 'training'
I have script ready to remove comma from the string and store words from the input string in a temporary table. But this is the easiest part.
The Confusing part now for me is to write the optimal code for retrieving the exact match from the key_search table as there is no limit on how many words can be in the string, it can be 1, 2, 3 or more.
Any suggestions on how should I handle this search?
Hi, My company has recently migrated our Informix database to SQL server 2K. The data is successfully migrated and the client are able to connect to the database. However, when trying to run a VB application to access the data, it keeps on prompting for SQL server login whenever an sql statement is executed. What could be the problem? We are using SQL server 2k on Windows 2000 and on the client Windows 95. Thanks!
I have a bcp which generates .txt file perfectly. I just wanted to know how can i generate a text file in distributed environment.
Assuming that my Sql Server is running in machine A. I wanted the bcp to generate in Machine B. What are the permission's i should give in order to generate it in Machine B.
Is there a stored proc or a function I can call from Query Analyzer to execute another .EXE and return when it's finished?
I'd like something like SET @RET = sp_CallEXE('c:mypathmyprogram.exe myparameters')
(Except for the name of the function, there should be something that does this right? I mean, DTS does it already so it must be referring to a function or a SP.)
I want an answer to so that I can validate that everything went well (hence the @RET variable)
Does anyone know where to purchase a good (or great) SQL hour scheduler program, and pulls up information from a SQL server and puts this information into a schedule (hourly schedule). I'm looking for something that will show the schedule that people work, the information off the SQL server needed is the "agent" name. If anyone could help me, that would be greatly appreciated.
I have the following problem. I need to insert 100.000 records (50Kb each) in one operation from a VB program into a SQL Server 2005 database. All of these records will be ready for inserting at the same time. How to make this insert as one big transaction instead of 100.000 small ones?
Hi. First 3 paragraphs are about problem in general - this is for those who consider them well experienced and may have better ideas about how to solve this whole thing. In forth paragraph is the tehnical question.
Hi. First 3 paragraphs are about problem in general - this is for those who consider them well experienced and may have better ideas about how to solve this whole thing. In forth paragraph is the tehnical question.
Situation: So me was trying to find out why files are saved in database incorrectly. First idea was to create a MD5 checksum of a file in my application and then create one with SQL script that saves data in database (data being the file, by the way).
On software side it worked fine 'cuz i'm developing in Visual Basic .NET 2005 which has a function that return a 32 byte array of hash from a data that you pass to it (like file) - GREAT!
SQL Server 2005 side - not so great. The only function that I have found so far that creates hash is HashBytes that is supposed to do it's job only there's a limintation to data size which means i cant make hash of say 4mb big file.
Problem: So I figure maybe i could create a vb.net program that return a hash from a data passed to it and call it with SQL script (because hashbytes function doesnt work for me in case you didnt read the first 3 paragraphs)... but I don't know how:( Any ideas?