Hi there,
Not sure if this is the right place to ask.
I have a custom object in ASP.NET called TransactionResponseObject.
And I want to save this object AS IS - in one piece in SQL Server 2005 (instead of taking each and every property of it and individually saving it into separate columsn of a table in the database).
Question:
1). What type of SQL Server 2005 datatype will I be using in this case ?
2). Is there a good and easy tutorial on converting a custom object into XML format? and perhaps saving the xml into the database (I feel it's just an extra step - meaning extra processing which i want to avoid).
In Management Studio, under Registered Servers, I double-click a server name (could be sql 2000 or sql 2005 server) and it apperars in "Object Explorer" where I can work with it. I click the "Save All" button in Management Studio, exit Studio, and re-start Studio. When I do, I find that all the servers I placed under "Object Explorer" are now missing and I need to go through the "double-click the registered server" ritual again. And again, and again.
What am I doing wrong here? Why don't the servers "stick" in Object Explorer?
Hello,I am working on a .NET project and I would like to save some LOCALIZED content in an SQL 2005 database.This content might be a string, a number or even a class with its properties values defined so I can retrieve it later.I will not need search or any complex operation just the following:1. Add content to the database2. Remove content from the database by contentId3. Get content from the database by contentIdAnyway, is this possible?What SQL 2005 datatype should I use to accomplish this?Thanks,Miguel
Hello:I didn't find any documentation that notes save point names are casesensitive, but I guess they are...Stored Proc to reproduce:/* START CODE SNIPPET */If Exists (Select * From sysobjects Where Type = 'P' and Name ='TestSaveTran')Drop Procedure dbo.TestSaveTranGoCreate Procedure dbo.TestSaveTranAsBeginDeclare@tranCount int--Transaction HandlingSelect @tranCount = @@TRANCOUNTIf (@tranCount=0)Begin Tran localtranElseSave Tran localtranBegin Try--Simulate Error While ProcessingRAISERROR('Something bad happened', 16, 1)/*If this proc started transaction then commit it,otherwise return and let caller handle transaction*/IF (@tranCount=0)Commit Tran localtranEnd TryBegin Catch--Rollback to save pointRollback Tran LOCALTRAN --<< NOTE case change--Log Error--Reraise ErrorEnd CatchEndGo--Execute Stored ProcExec dbo.TestSaveTran/*Should receive the following message:Cannot roll back LOCALTRAN. No transaction or savepoint of that namewas found.*//* END CODE SNIPPET */What is really strange, if there is a transaction open, then no erroris thrown. So if you execute as so:/* START CODE SNIPPET */Begin Tran--Execute Stored ProcExec dbo.TestSaveTran/* END CODE SNIPPET */There is no "Cannot roll back LOCALTRAN...." message.Questions:1-)Can someone confirm save point names are case sensitve and this isnot happening because of a server setting?2-)Is this a logic error that I am not seeing in the example codeabove?We have changed our code to store the save point name in a variable,which will hopefully mitigate this "problem".Thx.
Hi All, I am using Custome DLL in My reports. In my DLL we have a conncetion to database Sql Server 2005 which is fetching some records based on a Query.
My problem is it is working fine in Visual Studio. But in RS http://localhost/reportserver its not working and giving #Error for that particuler member.
I had give permission "SqlClientPermission" in my permission set. Which is like
Hi, I have 10 rows in my table, it has int as primary key, (Autogen). I need to take rows in my custome format, I can't use desc, asc on existinc column.. I need to provide order by giving a row no. sequence. Can you tell me how to do that? like order by pk (......).
Hi, I am attempting to implement a custome paging solution for my web Application, I have a table that has 30,000 records and I need to bw able to page through these using a Gridview. Here is my curent code but it generates an error when I try to compile the Stored Procedure, I get the following errors:<Error messages> These are on the first SELECT Line..Msg 4104, Level 16, State 1, Procedure proc_NAMEGetPaged, Line 17The multi-part identifier "dbo.NAME.CODE" could not be bound.Msg 4104, Level 16, State 1, Procedure proc_NAMEGetPaged, Line 17The multi-part identifier "dbo.NAME.LAST_NAME" could not be bound.Msg 4104, Level 16, State 1, Procedure proc_NAMEGetPaged, Line 17The multi-part identifier "dbo.NAME.FIRST_NAME" could not be bound.Msg 4104, Level 16, State 1, Procedure proc_NAMEGetPaged, Line 17The multi-part identifier "dbo.NAME.MIDDLE_NAME" could not be bound.Msg 4104, Level 16, State 1, Procedure proc_NAMEGetPaged, Line 17The multi-part identifier "dbo.NAMETYPE.TYPE" could not be bound.Msg 4104, Level 16, State 1, Procedure proc_NAMEGetPaged, Line 17The multi-part identifier "dbo.FUNERAL.NUMBER" could not be bound.Msg 4104, Level 16, State 1, Procedure proc_NAMEGetPaged, Line 17The multi-part identifier "mort.NAME.CODE" could not be bound.Msg 4104, Level 16, State 1, Procedure proc_NAMEGetPaged, Line 17The multi-part identifier "NAME.LAST_NAME" could not be bound.Msg 4104, Level 16, State 1, Procedure proc_NAMEGetPaged, Line 17The multi-part identifier "NAME.FIRST_NAME" could not be bound.Msg 4104, Level 16, State 1, Procedure proc_NAMEGetPaged, Line 17The multi-part identifier "NAME.MIDDLE_NAME" could not be bound.Msg 4104, Level 16, State 1, Procedure proc_NAMEGetPaged, Line 17The multi-part identifier "NAMETYPE.TYPE" could not be bound.Msg 4104, Level 16, State 1, Procedure proc_NAMEGetPaged, Line 17The multi-part identifier "FUNERAL.NUMBER" could not be bound. </Error Messages><Sotred Procedure> CREATE PROCEDURE proc_NAMEGetPaged @startRowIndex int, @maximumRows intASBEGIN -- SET NOCOUNT ON added to prevent extra result sets from -- interfering with SELECT statements. SET NOCOUNT ON; SELECT NAME.CODE, NAME.LAST_NAME, NAME.FIRST_NAME + ' ' + NAME.MIDDLE_NAME AS Name, NAMETYPE.TYPE, FUNERAL.NUMBER FROM (SELECT CODE, LAST_NAME, FIRST_NAME + ' ' + MIDDLE_NAME AS Name, NAMETYPE.TYPE, FUNERAL.NUMBER, ROW_NUMBER() OVER(ORDER BY LAST_NAME) as RowNum FROM Name n) as NameInfo WHERE RowNum BETWEEN @startRowIndex AND (@startRowIndex + @maximumRows) -1ENDGO </Stored Procedure> Any assistance in resolving this would be greatly appreciated.. Regards..Peter.
Does any one has any clue for this error ? I did went through a lot of articles on this error but none helped . I am working in Visual studie 2005 and trying to upload image in sql database through a simple form. Here is the code
using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.Data.SqlClient; using System.Web.Configuration; using System.IO; public partial class Binary_frmUpload : System.Web.UI.Page {protected void Page_Load(object sender, EventArgs e) { }protected void btnUpload_Click(object sender, EventArgs e) {if (FileUpload.HasFile == false) { // No file uploaded!lblUploadDetails.Text = "Please first select a file to upload..."; } else {string str1 = FileUpload.PostedFile.FileName; string str2 = FileUpload.PostedFile.ContentType; string connectionString = WebConfigurationManager.ConnectionStrings["GSGA"].ConnectionString; //Initialize SQL Server Connection SqlConnection con = new SqlConnection(connectionString); //Set insert query string qry = "insert into Officers (Picture,PictureType ,PicttureTitle) values(@ImageData, @PictureType, @PictureTitle)"; //Initialize SqlCommand object for insert. SqlCommand cmd = new SqlCommand(qry, con); //We are passing Original Image Path and Image byte data as sql parameters. cmd.Parameters.Add(new SqlParameter("@PictureTitle", str1)); cmd.Parameters.Add(new SqlParameter("@PictureType", str2));Stream imgStream = FileUpload.PostedFile.InputStream; int imgLen = FileUpload.PostedFile.ContentLength;byte[] ImageBytes = new byte[imgLen]; cmd.Parameters.Add(new SqlParameter("@ImageData", ImageBytes)); //Open connection and execute insert query. con.Open(); cmd.ExecuteNonQuery(); con.Close(); //Close form and return to list or images.
} } }
Object reference not set to an instance of an object. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.Source Error:
Line 32: Line 33: string str2 = FileUpload.PostedFile.ContentType; Line 34: string connectionString = WebConfigurationManager.ConnectionStrings["GSGA"].ConnectionString; Line 35: Line 36: //Initialize SQL Server Connection Source File: c:UsersManojDocumentsVisual Studio 2005WebSitesGSGABinaryfrmUpload.aspx.cs Line: 34 Stack Trace:
[NullReferenceException: Object reference not set to an instance of an object.] Binary_frmUpload.btnUpload_Click(Object sender, EventArgs e) in c:UsersManojDocumentsVisual Studio 2005WebSitesGSGABinaryfrmUpload.aspx.cs:34 System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105 System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +107 System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5102
When I try and run Report Builder Reports i get this error message "Object reference not set to an instance of an object. "
I can run reports locally but not from Report manager
here is the stack trace info
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace:
[NullReferenceException: Object reference not set to an instance of an object.] Microsoft.Reporting.WebForms.WebRequestHelper.GetExceptionForMoreInformationNode(XmlNode moreInfo, XmlNamespaceManager namespaces) +18 Microsoft.Reporting.WebForms.WebRequestHelper.ExceptionFromWebResponse(Exception e) +358 Microsoft.Reporting.WebForms.ServerReport.ServerUrlRequest(Boolean isAbortable, String url, Stream outputStream, String& mimeType, String& fileNameExtension) +482 Microsoft.Reporting.WebForms.ServerReport.InternalRender(Boolean isAbortable, String format, String deviceInfo, NameValueCollection urlAccessParameters, Stream reportStream, String& mimeType, String& fileNameExtension) +958 Microsoft.Reporting.WebForms.ServerReportControlSource.RenderReport(String format, String deviceInfo, NameValueCollection additionalParams, String& mimeType, String& fileExtension) +84 Microsoft.Reporting.WebForms.ExportOperation.PerformOperation(NameValueCollection urlQuery, HttpResponse response) +143 Microsoft.Reporting.WebForms.HttpHandler.ProcessRequest(HttpContext context) +75 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +154 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +64
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.210
I'm getting this problem 'Object reference not set to an instance of an object.' whenever I try to review a report and I checked the log file and this is what it had
w3wp!ui!1!11/14/2006-10:54:20:: Unhandled exception: System.NullReferenceException: Object reference not set to an instance of an object. at Microsoft.Reporting.WebForms.WebRequestHelper.GetExceptionForMoreInformationNode(XmlNode moreInfo, XmlNamespaceManager namespaces) at Microsoft.Reporting.WebForms.WebRequestHelper.ExceptionFromWebResponse(Exception e) at Microsoft.Reporting.WebForms.ServerReport.ServerUrlRequest(Boolean isAbortable, String url, Stream outputStream, String& mimeType, String& fileNameExtension) at Microsoft.Reporting.WebForms.ServerReport.GetStyleSheet(String styleSheetName) at Microsoft.Reporting.WebForms.ReportServerStyleSheetOperation.PerformOperation(NameValueCollection urlQuery, HttpResponse response) at Microsoft.Reporting.WebForms.HttpHandler.ProcessRequest(HttpContext context) at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
Some previous forums stated checking the webconfig file but the web config file look okay. Is there another way to fix this.
I am new to sql sever management studio express, but a long time query analyzer user. This is a very basic question.
I want to change the default directory in sql server management studio express so that when I go to save a query, it is already pointed to the correct one. Where do I change that?
I am trying to create a website that people can upload an image and have it saved to a database. Can someone point me in the right direction on this? What properties need to be saved in the db and how?
I have the need to allow a user to upload a file via the web and then save it into a database. THen I also need to be able to retrieve the file for download.
Can someone give me guidance as to code or a sample on how to do this.
When I am trying to save byte[] of an image to SQL server which is having an image column, I am getting an error like this " A severe error occured on the current command. The results, if any, should be discarded.". I am trying to save through a stored procedure. In the sp also, the datatype is image.
Hi im trying to save the location of images to a sql server db in the form of a url, i am trying to find out what datatype this comes under here. In ms access u can just select the hyperlink option in the data type dropdown and it saves the address entered into these fields as a hyperlink to the database. How can u do this in sql server ?????
Hello All, I have a problem with my database. It appears that it does not save the passwords for a login account that I have created. Every time I put in the password (using the Management Studio) it looks like the new password has been accepted. But when I look at the password using properties, the password is different. Any ideas? Thanks a lot for your help.
The SaveToSQLServer method has encountered OLE DB error code 0x80004005 (Client unable to establish connection). The SQL statement that was issued has failed.
------------------------------
The SaveToSQLServer method has encountered OLE DB error code 0x80004005 (Client unable to establish connection). The SQL statement that was issued has failed.
------------------------------ BUTTONS:
OK ------------------------------
===================================
Could not save the package "C:copiaPackage.dtsx" to SQL Server "ATLANTE". (Package Installation Wizard)
===================================
The SaveToSQLServer method has encountered OLE DB error code 0x80004005 (Client unable to establish connection). The SQL statement that was issued has failed.
The SaveToSQLServer method has encountered OLE DB error code 0x80004005 (Client unable to establish connection). The SQL statement that was issued has failed.
Scenario: I have created a dataset from an excel file to display it on a screen. Now I would like to save this same dataset in a SQL Server table. Any ideas would be greatly appreciated.
Hi, I want to upload a file (e.g. .xls, .pdf, .doc) and save into the Sql Server 2000 database through the web interface, and then to download this file. Any idea???
Hi,on my dev-machine i am running SQL Server 2005 Standard Edition.Now i have to do a project for a client who is on a server with ASP.NET 1.1 and SQL Server 2000.Is there a way i can build his database in 2005 and export or whatever it as SQL Server 2000?I don't really like the idea of installing 2000 and 2005 side by side on the same machine.Thank you very much in advance.Tjerk Heringa
I previously installed SQL 7.0 on my machine. The name of the Server was DEVELOPMENT. Unfortunately I needed to change the computer name, but I had already created my databases and did not want to lose the information. It was suggested that I should simply change the computer name and reinstall SQl. I changed the name to DEVSERVER. This seemed to work fine. Now I am having a problem when I try to create a DTS package on the renamed server from another SQL server . I receive the following error. "A connection could not be established to Development. Specified SQLserver not found" The server which is now called Devserver, is registered on the server I am creating the package from, however the message seems to imply that the server I'm connecting to is still called Developement and cannot be found. Any ideas would be appreciated.
I am working on query performance and tuning. I want to save current statistics for the latter use. do SQL Server provide any utility or command (like exec dbms_stats in ORACLE and OPTDIAG in sybase) to do this? thanks
Hi There,This is related to a ms access database but since I use the SqlDataSource control I thought I should post here.I have a project that I was working on with this ms access db and using sql controls, everything was working just finesince one day I started getting "Object reference not set to an instance of an object" messages when I try to designa query or retrieve a schema, nothing works at design time anymore but at runtime everything is perfect, its a lotof work for me now to create columns,schemas and everything manually, I've tried reinstalling visualstudio, ado componentsbut nothing seems to fix it, did this ever happen to any of you guys?any tip is really appreciated thanks a lot
Not sure if this is the right forum to post this question to, so if it's not, please accept my apologies.
I'm working in SQL Server 2005 with a database that was migrated to 2005 from SQL Server 2000. I have to alter a trigger on a table for some functionality changes, and when I modify the trigger and then access it through the application the database is working with, I receive this error:
There was a error in the [stored procedure name] procedure. Error Number: -2147217900 Error Description: [Microsoft][ODBC SQL Server Driver][SQL Server]The definition of object '[trigger name]' has changed since it was compiled.
[stored procedure name] and [trigger name] are where the actual names appear in the message.
I've tried running sp_recompile on the trigger, stored procedure, and table that are associated with this, and nothing works. I have dropped the trigger, which allows the save process to complete (but doesn't perform the required functionality, of course), and then re-created the trigger, but the error message still comes up. The compatibility level for the database is SQL Server 2000 (80) (as it was migrated from SQL Server 2000 as I mentioned above).
Has anyone seen this, and if so, how can I fix it?
Help! I have posted this before and I had hoped that the VS2005 SP1 would help my problem. It didn't. My code is shown below. I have dropped a sqlconnection, sqldataadapter and a strongly-typed dataset from the toolbox onto the component designer for my page and written my code. It compiles without any errors but at runtine I receive the system error "Object reference not set to an instance of an object." The error occurs at the first line where the sqldataadapter is mentioned. I have shufflled the code and the error still occurs at first mention of the dataadapter. I have set parameters to a simple string such as "myemail." It hasn't helped. I have used the "Dim" statement as "Dim DaAuthorLogin as System.Data.SqlClient.SqlDataadapter and Dim DaAuthorLogin as New ......) at the start of the private sub generated by the event requiring the data. Nothing helps. Here is my simple code to select data from a sqlserver 2000 database. Why do I continue to get this error? Partial Class AuthorLogin Inherits System.Web.UI.Page Protected WithEvents AuthorInformation As System.Web.UI.Page #Region " Web Form Designer Generated Code " 'This call is required by the Web Form Designer. <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent() Me.SqlSelectCommand1 = New System.Data.SqlClient.SqlCommand Me.DaAuthorLogin = New System.Data.SqlClient.SqlDataAdapter Me.MDData = New System.Data.SqlClient.SqlConnection Me.DsAuthorLogin = New MedicalDecisions.DsAuthorLogin CType(Me.DsAuthorLogin, System.ComponentModel.ISupportInitialize).BeginInit() ' 'SqlSelectCommand1 ' Me.SqlSelectCommand1.CommandText = "SELECT AuthorAlias, AuthorEmail, AuthorPassword, LastName, PreferredName" & Global.Microsoft.VisualBasic.ChrW(13) & Global.Microsoft.VisualBasic.ChrW(10) & "FRO" & _ "M T_Author" & Global.Microsoft.VisualBasic.ChrW(13) & Global.Microsoft.VisualBasic.ChrW(10) & "WHERE (AuthorEmail = @AuthorEmail) AND (AuthorPassword =" & _ " @AuthorPassword)" Me.SqlSelectCommand1.Connection = Me.MDData Me.SqlSelectCommand1.Parameters.AddRange(New System.Data.SqlClient.SqlParameter() {New System.Data.SqlClient.SqlParameter("@AuthorEmail", System.Data.SqlDbType.NVarChar, 50, "AuthorEmail"), New System.Data.SqlClient.SqlParameter("@AuthorPassword", System.Data.SqlDbType.NVarChar, 50, "AuthorPassword")}) ' 'DaAuthorLogin ' Me.DaAuthorLogin.SelectCommand = Me.SqlSelectCommand1 Me.DaAuthorLogin.TableMappings.AddRange(New System.Data.Common.DataTableMapping() {New System.Data.Common.DataTableMapping("Table", "T_Author", New System.Data.Common.DataColumnMapping() {New System.Data.Common.DataColumnMapping("AuthorAlias", "AuthorAlias"), New System.Data.Common.DataColumnMapping("AuthorEmail", "AuthorEmail"), New System.Data.Common.DataColumnMapping("AuthorPassword", "AuthorPassword"), New System.Data.Common.DataColumnMapping("LastName", "LastName"), New System.Data.Common.DataColumnMapping("PreferredName", "PreferredName")})}) ' 'MDData ' Me.MDData.ConnectionString = "Data Source=CIS1022DAVID;Initial Catalog=CGData;Integrated Security=True;Pooling" & _ "=False" Me.MDData.FireInfoMessageEventOnUserErrors = False ' 'DsAuthorLogin ' Me.DsAuthorLogin.DataSetName = "DsAuthorLogin" Me.DsAuthorLogin.SchemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema CType(Me.DsAuthorLogin, System.ComponentModel.ISupportInitialize).EndInit() End Sub Friend WithEvents SqlSelectCommand1 As System.Data.SqlClient.SqlCommand Friend WithEvents MDData As System.Data.SqlClient.SqlConnection Friend WithEvents DaAuthorLogin As System.Data.SqlClient.SqlDataAdapter Friend WithEvents DsAuthorLogin As MedicalDecisions.DsAuthorLogin 'NOTE: The following placeholder declaration is required by the Web Form Designer. 'Do not delete or move it. Private designerPlaceholderDeclaration As System.Object Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) 'CODEGEN: This method call is required by the Web Form Designer 'Do not modify it using the code editor. InitializeComponent() End Sub #End Region Private Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) 'no code here End Sub Private Sub AuthorLoginRegister_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AuthorLoginRegister.Click 'for new author registration Response.Redirect("AuthorInformation.aspx") End Sub Private Sub AuthorLoginBack_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AuthorLoginBack.Click 'to navigate back Response.Redirect("MainPaths.aspx") End Sub Protected Sub AuthorLoginPassword_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AuthorLoginPassword.TextChanged 'pass the parameters to the dataadapter and return dataset DaAuthorLogin.SelectCommand.Parameters("@AuthorEmail").Value = AuthorLoginEmail.Text DaAuthorLogin.SelectCommand.Parameters("@AuthorPassword").Value = AuthorLoginPassword.Text MDData.Open() DaAuthorLogin.Fill(DsAuthorLogin, "T_Author") MDData.Close() 'set session objects If DsAuthorLogin.T_Author.Rows.Count > 0 Then Session("AuthorAlias") = DsAuthorLogin.T_Author(0).AuthorAlias Session("LastName") = DsAuthorLogin.T_Author(0).LastName Session("PreferredName") = DsAuthorLogin.T_Author(0).PreferredName Response.Redirect("AuthorPaths.aspx") Else : AuthorLoginNotValid.Visible = True AuthorLoginEmail.Text = "" AuthorLoginPassword.Text = "" End If End Sub End Class