SQL Server DB And Fileupload Control

May 22, 2008

I have a project that is using an exsisting SQL DB that stores uploaded files and images into the DB.

I am trying to figure out how to take the file from the fileupload control and place it into the DB field.

Almost all the examples I've seen deal specifically with images but I will not know what the file type is. It could be an image, a word doc, and excel file, a text file ect.

I thought to use a INSERT statement but I wonder if that will work.

I know that fileupload.postedfile.saveas saves the file to a directory you name but that does not help me. I thought I could just use the fileupload.contents property in the Parameter add statement but that must not be an option as I cannot find and example of that usage besides that would just be too easy I guess.

Any help or code would be accepted with great gratituide. I realize that this is not the best way for performance but it is what it is and I cannot scrap the old DB I just have to make it work.

Thanks,

Ty

View 7 Replies


ADVERTISEMENT

FileUpload Control And SQL Server 2005.

Aug 15, 2006

Hello,
I have a FileUpload control on my webform. I would like a user to be able to upload a file to the server. Is there any way to store this file in SQL Server 2005?
Thanks
ASPSQL66

View 1 Replies View Related

FileUpload Control And MS SQL

Jun 1, 2006

I am trying to use the FileUpload control to save a filename to a SQL database. I'm using the OnUpdating event for my SQLDataSource to add the filename to the UpdateParameters. The OnUpdating event is firing but the FileName doesn't get added to the database. Any pointers as to why that might be would be very helpful.
Here's the code. Thanks much.
<%@ Page Language="VB" MasterPageFile="~/MasterPage.master" Title="File Upload Testing" %>
<script runat="server">
Sub Page_Load()
Response.Write("UpdateParameters(0)=" & dsLabel.UpdateParameters(0).Name & "<br />")
Response.Write("UpdateParameters(1)=" & dsLabel.UpdateParameters(1).Name & "<br />")
End Sub

Sub dsLabel_OnUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.SqlDataSourceCommandEventArgs)
Dim FileUploadControl As FileUpload = DetailsView1.FindControl("FileUpload1")
Dim strFileName As String = FileUploadControl.FileName
dsLabel.UpdateParameters(0).DefaultValue = strFileName
dsLabel.UpdateParameters(1).DefaultValue = Request.QueryString("rgstnID")
Response.Write("dsLabel.UpdateParameters(0).DefaultValue = " & dsLabel.UpdateParameters(0).DefaultValue & "<br />")
Response.Write("dsLabel.UpdateParameters(1).DefaultValue = " & dsLabel.UpdateParameters(1).DefaultValue & "<br />")
End Sub
</script>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<h1>File Upload</h1>
This page should allow me to use the FileUpload Control to save a filename to an MS SQL Database.<br />
<br />
&nbsp;<asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False"
DataSourceID="dsLabel" Height="50px" Width="125px">
<Fields>
<asp:TemplateField HeaderText="File" SortExpression="labelName">
<EditItemTemplate>
<asp:FileUpload ID="FileUpload1" runat="server" />
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Bind("labelName") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:CommandField ButtonType="Button" ShowEditButton="True" />
</Fields>
</asp:DetailsView>
<br />
<br />
<asp:SqlDataSource ID="dsLabel" runat="server"
ConnectionString="Data Source=FILESERVER1;Initial Catalog=IM;Integrated Security=True"
OnUpdating="dsLabel_OnUpdating"
ProviderName="System.Data.SqlClient"
SelectCommand="SELECT labelName FROM tblProductRegistration WHERE (registrationID = @registrationID)"
UpdateCommand="UPDATE tblProductRegistration SET labelName = @LabelName WHERE (registrationID = @registrationID)">
<UpdateParameters>
<asp:Parameter ConvertEmptyStringToNull="True" Name="LabelName" />
<asp:QueryStringParameter Type="Int64" Name="registrationID" QueryStringField="rgstnID" />
</UpdateParameters>
<SelectParameters>
<asp:QueryStringParameter Name="registrationID" QueryStringField="rgstnID" />
</SelectParameters>
</asp:SqlDataSource>
</asp:Content>

View 2 Replies View Related

Fileupload Inside A CreateuserWizard Control ?

Sep 7, 2006

HiHoping someone can help me , I am looking to add a file upload inside a createuserWizard but am banging my head at this stage I can get in working saving the file selected in the Fileupload into  a table on the database using a datatype "image" for the field.However
ideally I would like to save a string of the file path to the database
and save the  actual file to the filesystem of the webserver.The
problem for me is that this is inside a CreateUserWizard, I gather the
standard information and them have "extended" the wizard  by adding
another wizard step , which will include a FileUpload control. I need
to invoke the FileUpload when the user select the createUser button of
the CreateUserWizard control( CreateUserWizard1_CreatedUser in the aspx.cs)  I
am able to write the SQL that  allows save information from a textbox
to a database tabel but not able to write the functionality to 1.Uplaod file to webServer when user selects Create User button 2. Save this path in a table on the database.I've tried loads but cannot get it to work I'm using C# for this.  here's a scaled down version of my code with just teh CreateUserWizard which contains the fileUploadaspx ( Contains a create user Wizard which inturn contains a Fileupload) <%@ Page Language="C#" AutoEventWireup="true"  CodeFile="FORUMcreateuser.aspx.cs" Inherits="_Default" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" ><head id="Head1" runat="server">    <title>Sign Up Page</title></head><body>    <form id="form1" runat="server" enctype="multipart/form-data">       
<atlas:ScriptManager id="MasterScriptManager"
EnableScriptGlobalization="false"
runat="Server"></atlas:ScriptManager>    <div>       
<asp:CreateUserWizard ID="CreateUserWizard1" runat="server"
BackColor="White" BorderColor="#FFDFAD" BorderStyle='Solid'
BorderWidth='1px' Font-Names='Verdana' Font-Size='0.8em'
OnCreatedUser='CreateUserWizard1_CreatedUser'>            <WizardSteps>                <asp:WizardStep ID="CreateUserWizardStep0" runat="server">                    <table id="Table2" style='width: 100%'>                        <tr>                            <td style='color: blue'>                                <strong>Step 1 of 2</strong></td>                            <td style='color: white'>                                PlaceHolderBGColor</td>                            <td>                            </td>                        </tr>                        <tr>                            <td>                            </td>                            <td style='color: white'>                            </td>                            <td>                            </td>                        </tr>                        <tr>                            <td>                                First Name:</td>                            <td>                                <asp:TextBox runat="server" ID="txtFirstName" MaxLength="50" />                            </td>                            <td>                               
<asp:RequiredFieldValidator runat="server"
ID="RequiredFieldValidator15" ControlToValidate="txtFirstName"                                     ErrorMessage="First Name is required." />                            </td>                        </tr>                        <tr>                            <td>                                Last Name:</td>                            <td>                                <asp:TextBox runat="server" ID="txtLastName" MaxLength="50" />                            </td>                            <td>                               
<asp:RequiredFieldValidator runat="server"
ID="RequiredFieldValidator16" ControlToValidate="txtLastName"                                     ErrorMessage="Last Name is required." />                            </td>                        </tr>                        <tr>                            <td>                            </td>                            <td style='color: white'>                                PlaceHolderBGColor</td>                            <td>                            </td>                        </tr>                        <tr>                            <td>                                File:</td>                            <td>                                &nbsp;<asp:FileUpload ID="FileUpload1" runat="server" />                            </td>                            <td>                                &nbsp;</td>                        </tr>                        <tr>                            <td>                            </td>                            <td>                            </td>                            <td>                            </td>                        </tr>                    </table>                    <br />                </asp:WizardStep>                               <asp:CreateUserWizardStep ID="CreateUserWizardStep2" runat="server">                <ContentTemplate>                    <table>                        <tr>                            <th align="left" style='color: blue'>                                Step 2 of 2</th>                        </tr>                        <tr>                            <th align="left">                                MRS Login Details                            </th>                        </tr>                        <tr>                            <td>Username:</td>                            <td>                                <asp:TextBox runat="server" ID="UserName" />                               
<asp:RequiredFieldValidator runat="server"
ID="RequiredFieldValidator9" ControlToValidate="UserName"                                     ErrorMessage="Username is required." />                            </td>                        </tr>                        <tr>                            <td>Password:</td>                            <td>                                <asp:TextBox runat="server" ID="Password" TextMode="Password" />                               
<asp:RequiredFieldValidator runat="server"
ID="RequiredFieldValidator10" ControlToValidate="Password"                                     ErrorMessage="Password is required." />                            </td>                        </tr>                        <tr>                            <td>Confirm Password:</td>                            <td>                                <asp:TextBox runat="server" ID="ConfirmPassword" TextMode="Password" />                               
<asp:RequiredFieldValidator runat="server"
ID="RequiredFieldValidator13" ControlToValidate="ConfirmPassword"                                     ErrorMessage="Confirm Password is required." />                            </td>                        </tr>                        <tr>                            <td>Email:</td>                            <td>                                <asp:TextBox runat="server" ID="Email" />                               
<asp:RequiredFieldValidator runat="server"
ID="RequiredFieldValidator11" ControlToValidate="Email"                                     ErrorMessage="Email is required." />                            </td>                        </tr>                        <tr>                            <td>                                Recover Password Question:</td>                            <td>                                <asp:TextBox runat="server" ID="Question" />                               
<asp:RequiredFieldValidator runat="server"
ID="RequiredFieldValidator12" ControlToValidate="Question"                                     ErrorMessage="Question is required." />                            </td>                        </tr>                        <tr>                            <td>                                recover Password Answer:</td>                            <td>                                <asp:TextBox runat="server" ID="Answer" />                               
<asp:RequiredFieldValidator runat="server"
ID="RequiredFieldValidator14" ControlToValidate="Answer"                                     ErrorMessage="Answer is required." />                            </td>                        </tr>                        <tr>                            <td colspan="2">                                 <asp:CompareValidator ID="PasswordCompare" runat="server" ControlToCompare="Password"                                       
ControlToValidate="ConfirmPassword" Display="Dynamic" ErrorMessage="The
Password and Confirmation Password must
match."></asp:CompareValidator>                            </td>                        </tr>                        <tr>                            <td colspan="2">                                <asp:Literal ID="ErrorMessage" runat="server" EnableViewState="False"></asp:Literal>                            </td>                        </tr>                    </table>                   
<asp:SqlDataSource ID="InsertExtraInfo" runat="server"
ConnectionString="<%$ ConnectionStrings:CONTACTSConnectionString
%>"                        InsertCommand="INSERT INTO [CLIENT]
([client_id], [First_Name], [Last_Name]) VALUES (@UserId, @FirstName,
@LastName)"                        ProviderName="<%$ ConnectionStrings:CONTACTSConnectionString.ProviderName %>">                        <InsertParameters>                           
<asp:ControlParameter Name="FirstName" Type="String"
ControlID="txtFirstName" PropertyName="Text" />                           
<asp:ControlParameter Name="LastName" Type="String"
ControlID="txtLastName" PropertyName="Text" />                        </InsertParameters>                                           </asp:SqlDataSource>                                    </ContentTemplate>                </asp:CreateUserWizardStep>                <asp:CompleteWizardStep ID="CompleteWizardStep1" runat="server">                </asp:CompleteWizardStep>            </WizardSteps>            <NavigationButtonStyle BackColor="White" BorderColor="#CC9966" BorderStyle='Solid'                BorderWidth="1px" Font-Names="Verdana" ForeColor="#990000" />            <HeaderStyle BackColor="#FFCC66" BorderColor="White" BorderStyle='Solid' BorderWidth='2px'                Font-Bold="True" Font-Size="0.9em" ForeColor="#333333" HorizontalAlign="Center" />            <CreateUserButtonStyle BackColor="White" BorderColor="#CC9966" BorderStyle='Solid'                BorderWidth="1px" Font-Names="Verdana" ForeColor="#990000" />            <ContinueButtonStyle BackColor="White" BorderColor="#CC9966" BorderStyle='Solid'                BorderWidth="1px" Font-Names="Verdana" ForeColor="#990000" />            <SideBarStyle BackColor="#990000" Font-Size="0.9em" VerticalAlign="Top" />            <TitleTextStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />            <SideBarButtonStyle ForeColor="White" />        </asp:CreateUserWizard>    </div>    </form></body></html> aspx.cs using System;using System.Data;using System.Configuration;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;public partial class _Default : System.Web.UI.Page{    protected void Page_Load(object sender, EventArgs e)    {    }    protected void CreateUserWizard1_CreatedUser(object sender, EventArgs e)    {        TextBox UserNameTextBox =            (TextBox)CreateUserWizardStep2.ContentTemplateContainer.FindControl("UserName");        SqlDataSource DataSource =            (SqlDataSource)CreateUserWizardStep2.ContentTemplateContainer.FindControl("InsertExtraInfo");        MembershipUser User = Membership.GetUser(UserNameTextBox.Text);        object UserGUID = User.ProviderUserKey;        DataSource.InsertParameters.Add("UserId", UserGUID.ToString());        DataSource.Insert();    }}  

View 1 Replies View Related

Uploading A File To A SQL Database Via A Typed Dataset And Using The FileUpload Control.

Oct 2, 2006

I am trying to upload a file in ASP.net 2.0 to a SQL database using the FileUpload control. I am doing this by way of a typed dataset.Here is my code.Dim rta As New ResponseTableAdapterDim rdt As ResponseDataTable = rta.GetResponseByID(1)Dim rr As ResponseRow = rdt(0)Dim fs As New FileStream(fu.PostedFile.FileName, FileMode.Open, FileAccess.Read)Dim br As New BinaryReader(fs)Dim image() As Byte = br.ReadBytes(fs.Length)br.Close()fs.Close()rr.UploadFile = imagerr.NameFile = fs.Namerta.Update(rdt)The code runs without an error but afterwards I find that nothing has been stored in the UploadFile cell in the database but the file name has been stored in the NameFile cell in the database. Any ideas?Your help is much appreciated. James 

View 1 Replies View Related

FileUpload

Apr 13, 2006

    I have gotten FileUpload in VB.Net to work fine in saving a file to a web server folder but cannot find some examples on how to save the file as an image on sql200.  Can anyone point me in the write direction - thanks.

View 3 Replies View Related

Using FileUpload To Store Image In SQL Database

Apr 24, 2008

Hi
I have a asp:FileUpload conponent that I am trying to use to retrieve a picture file from the clients pc and store it in a SQL database.
The table is called PropertyImage and it contains the following fields:
imgID (type = int - autoincrement); imgData (type = Image); imgTitle (type = VarChar); imgType (type = VarChar); imgLength (type = BigInt);
I have a button (Button1) which when clicked calls Button1_Click()
--------------------------------------------------protected void Button1_Click(object sender, EventArgs e)
{byte[] fileData = null;
Boolean status = false;if (FileUpload1 != null)
{
// Make sure the file has data.if ((FileUpload1.PostedFile != null) && (FileUpload1.PostedFile.ContentLength > 0))
{
// Get the filename.string fn = System.IO.Path.GetFileName(FileUpload1.PostedFile.FileName);
try
{
// Access the file stream and begin the upload. Store the file in a memory byte array.Stream MyStream = FileUpload1.PostedFile.InputStream;
long iLength = MyStream.Length;fileData = new byte[(int)MyStream.Length];MyStream.Read(fileData, 0, (int)MyStream.Length);
MyStream.Close();
}catch (Exception ex)
{ }
}
}SqlConnection connection = new SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\heidihomes.mdf;Integrated Security=True;User Instance=True");
try
{
connection.Open();SqlCommand sqlCmd = new SqlCommand("INSERT INTO PropertyImage (imgData, imgaTitle, imgType, imgLength) VALUES(@data,@title,@type,@length)");
SqlParameter param = new SqlParameter();
// String connectionString = new SqlConnection(sqlCmd, connection);
 param = new SqlParameter("@data", SqlDbType.Image);
param.Value = fileData;
sqlCmd.Parameters.Add(param);param = new SqlParameter("@title", SqlDbType.VarChar);
param.Value = fileData;
sqlCmd.Parameters.Add(param);param = new SqlParameter("@type", SqlDbType.VarChar);
param.Value = fileData;
sqlCmd.Parameters.Add(param);param = new SqlParameter("@length", SqlDbType.BigInt);
param.Value = fileData;
sqlCmd.Parameters.Add(param);
sqlCmd.ExecuteNonQuery();
connection.Close();status = true;
}catch (Exception ex){ }if (status)
{
UploadStatus.Text = "File Uploaded Successfully";Server.Transfer("Admin_PropertyView.aspx");
}
else
{UploadStatus.Text = "Uploaded Failed";
}
}
}
--------------------------------------------------
But when I click on the button, nothing happens.
Please could someone help me out here.  I have tried this a few times and still haven't come right.
Also, if there is something else wrong with the code, please let me know.
Thanking you in advance.

View 9 Replies View Related

Store Files In SQL From An ASP Page Using FileUpload

May 23, 2008

I am almost done with a simple page to have a user select a file (using the FileUpload object), give it a short description and associate it with an item from a listbox.  Thensave these pieces of data to a new row in a SQL DB.
My issue... 
The SQLSmd.ExecuteNonQuery FAILS...
I have got all the fields able to connect and almost save... but for the actual "document" field errors out.  The user can select any type of file (image, word, excel, Powerpoint, etc) for storage into the DB.  I am not storing a referance to a file or the path to a file but the actual file in SQL.In the DB I have the field (Document) set to a type of VarBinary(8000) in the table.  Here is thethe corrisponding code in my app... 
Dim bArray As Byte...bArray = FileUpload1.PostedFile.InputStream.ReadByte()... SQLCmd.Parameters.Add("@Document", Data.SqlDbType.VarBinary, 8000).Value = bArray...iReturn = SQLCmd.ExecuteNonQuery()
ERRORThe first section of the stact trace...
[InvalidCastException: Invalid cast from 'System.Byte' to 'System.Byte[]'.]   System.Convert.DefaultToType(IConvertible value, Type targetType, IFormatProvider provider) +867   System.Byte.System.IConvertible.ToType(Type type, IFormatProvider provider) +37   System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider) +408   System.Data.SqlClient.SqlParameter.CoerceValue(Object value, MetaType destinationType) +896

View 7 Replies View Related

Issue With SSRS Report Exporting To Excel With The Matrix Control Inside The Table Control

Jan 27, 2008

Hi All,
I am placing a Matrix inside the table control for grouping requirements,but when we export the report to the Excel, the contents inside the table cell are ignored. Is there any way to get the full report exported, as per the Requirement.Please help me with this issue.

With Thanks
M.Mahendra

View 5 Replies View Related

Is It Possible To Embbed And Ocx Control On A Report Or Some Sort Of Interactive Control Like A Flash.ocx?

Oct 25, 2007

does any one have and example of how to embedd a flash swf file onto a report.??? Is it possable? any examples would be helpful.

View 1 Replies View Related

Reporting Services From WebBrowser Control - Print = Unable To Load Client Print Control

Mar 20, 2007

UPDATE #2: When it said "Do you want to install Microsoft SQL Server" I said "yes" and that caused it to work. I exited and re-ran and now the print runs w/o the "install SQL Server" (If the prompt had said "Do you want to install the print dialog" we wouldn't be having this discussion...) 





UPDATE: After posting this i discovered that the same thing occurs when attempting to print the report direct from IE6: First a dialog pops up "Do you want to install this software?" Name: Microsoft SQL Server. When I click "Don't Install" I get the dialog "unable to load client print control." Since this happens direct from IE6 I suspect it's browser settings. I'll resume tomorrow and post a followup.







My WinForm C# app integrates Reporting Services by calling them from WebBrowser controls. The problem is attempts to print cause a dialog: "unable to load client print control."

I've read prior posts that say "enable Active-X in your browser" - I don't know how to do that from a WebBrowser control.



Any ideas how to support Reporting Services "Print" from within a WebBrowser control?

RELATED THREADS

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=332145&SiteID=1

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=264478&SiteID=1

 

 

View 1 Replies View Related

Error While Connect To SQL Server Using ADO Control

Jun 22, 2006

The following error happens in my ASP.NET page from time to time. It will disappear after I restart the SQL Server. I guess I messed up in the garbage collection, but I really don't know what to do except using "conn=nothing" statement, can anyone help me with this?
Thanks!
 
[DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access denied. 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.Runtime.InteropServices.COMException: [DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access denied.Source Error:



Line 39: Public Sub New()
Line 40: conn = New ADODB.Connection
Line 41: conn.Open("Provider=SQLOLEDB.1;Persist Security Info=xxxxx;User ID=xxxxx;Initial Catalog=xxxx;Data Source=xxx")
Line 42: rs = New ADODB.Recordset
Line 43: my_UserID = 0

View 7 Replies View Related

SQL Server Express For Login Control

Aug 11, 2006

I have built a page with the login control using the default sql server express database that is integrated into the application. I have got it working on my development machine and want to post it on the web with a web hosting company. I did not know if they had to have sql server express installed on that machine for my database to work properly or will it work with sql server 2005 installed. Most web hosting companies that I have called say they only support sql server 2005 and not sql server express. I was unsure if the login would work or not. Please help with this issue. I am new at ASP.net and really enjoy it. However, I want to ensure that my site will work on the web as it does on my machine.

View 4 Replies View Related

Sqldatasource Server Control Problem

Apr 2, 2007

Dear all,I am couping a dropdownlist and a sqldatasource control to display a column from a database of SQL/Server on browser. However, when I tried to configure the sqldatasource to let it get data from SQL/Server, it always report an error. It normally happens at the first step of creating new connection. After I specified the correct sql/server instance name, using SQL server authentication, and select a database name. Even the connection test can sucessfully passed. However, when I click the "OK" button, an error message saying "object reference not set to an instance of an object" popped out and I could not add new connections. The strange thing is that after I reintall the visual studio 2005 service pack 1. It will function properly for a while. After sometime, it will fail again.  Anybody has suggestions? Thanks a lot! 

View 1 Replies View Related

SQL Server Web Based Control Panel

Mar 24, 2004

My clients hosting company does not allow any direct interaction with SQL Server ie no Enterprise Manager/ Query Analyser access!

Are there any free web pages that i can download and then host on the clients server that allow me to create tables and stored procedures simply without writing a script for everything?

Thanks

Rich

View 2 Replies View Related

I Want Source Control For SQL Server 2000...

Apr 17, 2005

Hi guys'n'girls...
I currently work for a company where we develop several large ASP.NET applications which are VERY data centric. But lately we have run into a problem on our developer DB...
On the project I am working on we currenctly have approx. 10 developers working concurrently on the database. That means that we often run into errors caused by two developers working on the same stored procedure, function or trigger so the developer who adds his changes last, overwrites the modifications done by the other developer. The obvious answer is source control for the db, but as far as I can tell this is only available for stored procedures and not for functions or triggers... And even the stored procedure solution isn't very safe because it only works if every developer is editing the procedures through VS.
So what do we do? There must be some solution to this problem... And I'm pretty convinced that we are not the first company to face this problem. Are we doing it the wrong way or do you know another solution?
Thanks in advance!

View 1 Replies View Related

Do We Control Over Sql Server Error Log Files ?

May 9, 2001

Hi, everybody
I am trying to run job that will
look for errors in error log files and save it to text file
In order to get up to last minute infromation I am using errorlog

1. at what point errorlog ranamed to errorlog1?
2. Can configurate size of errorlog file ?
3. Can I configurate time when errorlog ranamed to errorlog1

when i run in Sql Query analyser
print '------------ level 16 from last Sql errorlog file ----------------'
print 'These messages indicate errors that can be corrected by the user '
USE master
EXEC xp_cmdshell 'findstr /i /n /c:"level 16" InnvisionGMSSQL7LOGerrorlog.*'
go

I getting output
------------ level 16 from last Sql errorlog file ----------------
These messages indicate errors that can be corrected by the user

(0 row(s) affected)

when my job saves this command to file
I getting output
------------ level 16 from last Sql errorlog file ---------------- [SQLSTATE 01000]
These messages indicate errors that can be corrected by the user [SQLSTATE 01000]

How replace [SQLSTATE 01000] on user friendly message

Thanks

View 2 Replies View Related

SQL Server Error Log - Growing Out Of Control

Sep 3, 1998

In the past month and a half I have had the SQL Server error log on one of my SQL Server 6.0 servers eat up ALL the free disk space on the partition containing SQL Server and the databases/devices.

This means that the error log gets to be about 3 GB in size!

When I try to run a `tail` against the error log to determine what errors might be filling up the log, I get `garbage` like it`s not really a text file. This has indicated to me that the error log is somehow becoming corrupt.

Anybody have similar experiences or suggestions?

Thanks!

View 1 Replies View Related

SQL Server License Control And Management

Mar 22, 2006

Today many applications (SAP, SIEBEL, MANUGISTICS, PEOPLESOFT, and soon) does not have a client direct access to connect to the database.They use an Application Server that has only one connection to thedatabase and the users get connected to this application server.THE QUESTION: How to control SQL Server User License in this new model,automatically?You cannot enable SQL Server Audit because users are not connecteddirectly to the database.You cannot use Identity Management applications because they do notwork on NOT Enterprise Business software.How to do that if you have hundred of applications and database?Regards,Marcio

View 9 Replies View Related

ListBox Web Server Control And Stored Procedure

May 15, 2008

Hi, I've a  ListBox Web Server Control where I select a list of citiesnow I would like to create a stored procedure with the selected values... please note that I use metods like these for execute my Stored procedure public DataSet Getgfdfgh(SqlConnection connection, String IDAttivitaTipo, DateTime DataInizio, DateTime DataFine)        {            ConnectionState currState = connection.State;            if (((connection.State & ConnectionState.Open) != ConnectionState.Open))                connection.Open();            try            {                SqlParameter[] parameters = new SqlParameter[3];                parameters[0] = new SqlParameter("@IDAttivitaTipo", IDAttivitaTipo);                parameters[1] = new SqlParameter("@DataInizio", DataInizio);                parameters[2] = new SqlParameter("@DataFine", DataFine);                SqlCommand cmd = CreateStoreProcedureCommand("Getfhdfh", connection, parameters);                SqlDataAdapter adapter = new SqlDataAdapter(cmd);                DataSet ds = new DataSet();                adapter.Fill(ds);                return ds;            }            finally            {                if ((currState == ConnectionState.Closed))                    connection.Close();            }        }   How Can I manage a list of values ??Thanks for help me!! 

View 1 Replies View Related

Error On Reporting Server - But Only Through The ReportViewer Control

Apr 11, 2006

We are using the webviewer control.

We get the following error when we try to export to EXCEL.



InternetExploer cannot download ...n=OnlyHtmlInline&Format=EXCEL from app.webcobra.com.

Internet Explorer was not able to open this Internet site. The requested site is either unavailable or cannot be found. Please try again later.



This error comes up almost immediatly after it starts trying to download the file. It is a large dataset but it isn't "overly large". There are basically 44 records.

The other wierd thing is that it works fine on our BETA servers but not on our Production servers. We figure this is a setting somewhere that we have missed.

And now I found out that if it just leave it sitting there it eventually asks me if I want to open the file and it opened fine.

So what was the above error all about????

Does anyone have any ideas that I can look into?

Thanks!

View 6 Replies View Related

Source Code Control And SQL Server Express??

Apr 18, 2006

Hi,

I was wondering if anybody could advise on source code control for SQL Server express, for the table schema and stored procedures?

I currently use Sourcesafe V6 to work with visual studio 6 and 2003 (although it isn't integrated in 2003), and wondered if that can be used?

Any suggestions would be greatly appreciated, as I see this as a disaster waiting to happen!

Thanks in advance.

Mark

View 4 Replies View Related

Detailsview Control - How To Edit Record In Sql Server Express

Aug 25, 2006

I have null values in some of the fields & when I use EDIT to make changes these changes are not recorded + I receive no error.  

View 1 Replies View Related

Control Transaction In Sybase Database Using Sql-server 2000

Apr 20, 2004

Can anyone help me with this scenario!!!!
I have a sybase database and a sqlserver 2000 database.
I want to insert data into sybase database table thru sql-server 2000 using distributed queries
When i execute the following the transaction


Create procedure myCurrentDataBaseProcedure
as
begin

begin tran
insert into mytable values(1)
if @@error <>0
begin
rollback transaction
return
end
insert into sybasedatabaseserver.databasename.dbo.tablename values(1)
if @@error <>0
begin
rollback transaction
return
end
commit transaction
end

The procedure is created in sql server database
trying to execute this procedure..shows error
The first part of the procedure is executed.

But the error is here
insert into sybasedatabaseserver.databasename.dbo.tablename values(1)
The data is succesfully inserted in the local database
I am unable to insert data into the remote database
Can anyone suggest me wht shd i do in this scenario
Are there any drivers to be loaded to commit this transactions

Pl.Help

View 5 Replies View Related

How To Control Error Log File In SQL Server 2005 Express?

Dec 30, 2007

I attached a SQL database called Cars, using the following code:




Code Block

IF NOT EXISTS(
SELECT *
FROM sys.databases
WHERE name = N'Cars'
)
CREATE DATABASE Cars
ON PRIMARY (FILENAME = 'C:DataServer FilesCars.mdf')
FOR ATTACH
GO






I then detached the database using:




Code Block

EXEC sp_detach_db @dbname = 'Cars'
,@skipchecks = 'true'
,@KeepFulltextIndexFile = 'true'
GO





I then copied the .mdf and .ldf to another folder, using Windows Explorer.

I then attached the database using the new folder name in my code.:




Code Block

IF NOT EXISTS(
SELECT *
FROM sys.databases
WHERE name = N'Cars'
)
CREATE DATABASE Cars
ON PRIMARY (FILENAME = 'C:DataNew FolderCars.mdf')
FOR ATTACH
GO







Now when I go to update my table, I see that I am hitting the .mdf in the new folder.

And, when I do my table updates, I see that I am hitting the .ldf in the old folder.

Two questions:
1. What did I do wrong, that updates are hitting the new .mdf, but the old .ldf?
2. How do I control what .ldf SQL Express uses?

I see references to 'SQL Server Agent' in the help pages, but do not see 'SQL Server Agent' within the application.

I see the reference to the old folder path, within the 'Database Properties Files page', but no possibity to edit the value.


View 5 Replies View Related

Can We Access Reporting Server By URL In The Enviornment Of Domain Control?

Dec 1, 2007



If the net is domain control.

Can we use reporting server as usual?

Or need some special setting about it for protect it working well?

Thanks

View 1 Replies View Related

How To Control SQL Server 2005 Express Installed As A Prerequisite

Jul 4, 2006

Suppose I check "SQL Server 2005 Express Edition" as one of the prerequisites for a custom app in a Windows Setup project.

From reading whatever docs I could get my hands on, it's still not clear to me how to control the installation of SQL Server Express with respect to things like instance name, service account, etc, etc.

In other words, this is stuff that's normally the domain of template.ini. However, there's no clear indication of where I should put template.ini so that the install of "prerequisite" SQL Server Express will see it and configure accordingly...

Thanks in advance to anyone who can help solve this...

Josh

View 3 Replies View Related

VB.NET Codebehind Code To Update SQL Server 2005 Using SQLDataSource Control?

Jul 20, 2007

Hi, I am a newbie in using ASP.NET 2.0 and ADO.NET.  I wrote a hangman game and want to record statistics at the end of each game.  I will create and update records in the database for each authenticated user as well as a record for the Anonymous, unauthenticated user.  After a win or loss has occurred, I want to programmatically use the SQLDataSource control to increment the statistics counters for the appropriate record in the database (note I don't want to show anything or get user input for this function).
I need a VB.NET codebehind example that will show me how I should set up the parameters and update the appropriate record in the database.  Below is my code.  What happens now is that the program chugs along happily (no errors), but the database record does not actually get updated.  I have done many searches on this forum and on the general Internet for programmatic examples of an update sequence of code.  If there is a tutorial for this online or a book, I'm happy to check it out.
Any help will be greatly appreciated.
Lambanlaa
CODE - Hangman.aspx.vb
1        Protected Sub UpdateStats()2            Dim playeridString As String3            Dim gamesplayedInteger, gameswonInteger, _4                easygamesplayedInteger, easygameswonInteger, _5                mediumgamesplayedInteger, mediumgameswonInteger, _6                hardgamesplayedInteger, hardgameswonInteger As Int327    8            ' determine whether player is named or anonymous9            If User.Identity.IsAuthenticated Then10               Profile.Item("hangmanplayeridString") = User.Identity.Name11           Else12               Profile.Item("hangmanplayeridString") = "Anonymous"13           End If14   15           playeridString = Profile.Item("hangmanplayeridString")16   17           ' look up record in stats database18           Dim hangmanstatsDataView As System.Data.DataView = CType(statsSqlDataSource.Select(DataSourceSelectArguments.Empty), System.Data.DataView)19   20           gamesplayedInteger = 021           gameswonInteger = 022           easygamesplayedInteger = 023           easygameswonInteger = 024           mediumgamesplayedInteger = 025           mediumgameswonInteger = 026           hardgamesplayedInteger = 027           hardgameswonInteger = 028   29           If hangmanstatsDataView.Table.Rows.Count = 0 Then30   31               '   then create record with 0 values32               statsSqlDataSource.InsertParameters.Clear() ' don't really know what Clear does33               statsSqlDataSource.InsertParameters("playerid").DefaultValue = playeridString34               statsSqlDataSource.InsertParameters("GamesPlayed").DefaultValue = gamesplayedInteger35               statsSqlDataSource.InsertParameters("GamesWon").DefaultValue = gameswonInteger36               statsSqlDataSource.InsertParameters("EasyGamesPlayed").DefaultValue = easygamesplayedInteger37               statsSqlDataSource.InsertParameters("EasyGamesWon").DefaultValue = easygameswonInteger38               statsSqlDataSource.InsertParameters("MediumGamesPlayed").DefaultValue = mediumgamesplayedInteger39               statsSqlDataSource.InsertParameters("MediumGamesWon").DefaultValue = mediumgameswonInteger40               statsSqlDataSource.InsertParameters("HardGamesPlayed").DefaultValue = hardgamesplayedInteger41               statsSqlDataSource.InsertParameters("HardGamesWon").DefaultValue = hardgameswonInteger42   43               statsSqlDataSource.Insert()44           End If45   46           ' reread the record to get current values47           hangmanstatsDataView = CType(statsSqlDataSource.Select(DataSourceSelectArguments.Empty), System.Data.DataView)48           Dim hangmanstatsDataRow As System.Data.DataRow = hangmanstatsDataView.Table.Rows.Item(0)49   50           ' set temp variables to database values51           gamesplayedInteger = hangmanstatsDataRow("GamesPlayed")52           gameswonInteger = hangmanstatsDataRow("GamesWon")53           easygamesplayedInteger = hangmanstatsDataRow("EasyGamesPlayed")54           easygameswonInteger = hangmanstatsDataRow("EasyGamesWon")55           mediumgamesplayedInteger = hangmanstatsDataRow("MediumGamesPlayed")56           mediumgameswonInteger = hangmanstatsDataRow("MediumGamesWon")57           hardgamesplayedInteger = hangmanstatsDataRow("HardGamesPlayed")58           hardgameswonInteger = hangmanstatsDataRow("HardGamesWon")59   60           ' update stats record61           'statsSqlDataSource.UpdateParameters.Clear()62           'statsSqlDataSource.UpdateParameters("playerid").DefaultValue = playeridString63   64           If Profile.Item("hangmanwinorloseString") = "win" Then65   66               statsSqlDataSource.UpdateParameters("GamesPlayed").DefaultValue = gamesplayedInteger + 167               statsSqlDataSource.UpdateParameters("GamesWon").DefaultValue = gameswonInteger + 168               Select Case Profile.Item("hangmandifficultyInteger")69                   Case 170                       statsSqlDataSource.UpdateParameters("EasyGamesPlayed").DefaultValue = easygamesplayedInteger + 171                       statsSqlDataSource.UpdateParameters("EasyGamesWon").DefaultValue = easygameswonInteger + 172                   Case 273                       statsSqlDataSource.UpdateParameters("MediumGamesPlayed").DefaultValue = mediumgamesplayedInteger + 174                       statsSqlDataSource.UpdateParameters("MediumGamesWon").DefaultValue = mediumgameswonInteger + 175                   Case 376                       statsSqlDataSource.UpdateParameters("HardGamesPlayed").DefaultValue = hardgamesplayedInteger + 177                       statsSqlDataSource.UpdateParameters("HardGamesWon").DefaultValue = hardgameswonInteger + 178               End Select79   80   81           ElseIf Profile.Item("hangmanwinorloseString") = "lose" Then82   83               statsSqlDataSource.UpdateParameters("GamesPlayed").DefaultValue = gamesplayedInteger + 184               Select Case Profile.Item("hangmandifficultyInteger")85                   Case 186                       statsSqlDataSource.UpdateParameters("EasyGamesPlayed").DefaultValue = easygamesplayedInteger + 187                   Case 288                       statsSqlDataSource.UpdateParameters("MediumGamesPlayed").DefaultValue = mediumgamesplayedInteger + 189                   Case 390                       statsSqlDataSource.UpdateParameters("HardGamesPlayed").DefaultValue = hardgamesplayedInteger + 191               End Select92           End If93   94           statsSqlDataSource.Update()95   96       End Sub97  
CODE - Hangman.aspx 1 <asp:SqlDataSource ID="statsSqlDataSource" runat="server" ConflictDetection="overwritechanges"
2 ConnectionString="<%$ ConnectionStrings:lambanConnectionString %>" DeleteCommand="DELETE FROM [Hangman_Stats] WHERE [PlayerID] = @original_PlayerID AND [GamesPlayed] = @original_GamesPlayed AND [GamesWon] = @original_GamesWon AND [EasyGamesPlayed] = @original_EasyGamesPlayed AND [EasyGamesWon] = @original_EasyGamesWon AND [MediumGamesPlayed] = @original_MediumGamesPlayed AND [MediumGamesWon] = @original_MediumGamesWon AND [HardGamesPlayed] = @original_HardGamesPlayed AND [HardGamesWon] = @original_HardGamesWon"
3 InsertCommand="INSERT INTO [Hangman_Stats] ([PlayerID], [GamesPlayed], [GamesWon], [EasyGamesPlayed], [EasyGamesWon], [MediumGamesPlayed], [MediumGamesWon], [HardGamesPlayed], [HardGamesWon]) VALUES (@PlayerID, @GamesPlayed, @GamesWon, @EasyGamesPlayed, @EasyGamesWon, @MediumGamesPlayed, @MediumGamesWon, @HardGamesPlayed, @HardGamesWon)"
4 OldValuesParameterFormatString="original_{0}" SelectCommand="SELECT PlayerID, GamesPlayed, GamesWon, EasyGamesPlayed, EasyGamesWon, MediumGamesPlayed, MediumGamesWon, HardGamesPlayed, HardGamesWon FROM Hangman_Stats WHERE (PlayerID = @playerid)"
5 UpdateCommand="UPDATE [Hangman_Stats] SET [GamesPlayed] = @GamesPlayed, [GamesWon] = @GamesWon, [EasyGamesPlayed] = @EasyGamesPlayed, [EasyGamesWon] = @EasyGamesWon, [MediumGamesPlayed] = @MediumGamesPlayed, [MediumGamesWon] = @MediumGamesWon, [HardGamesPlayed] = @HardGamesPlayed, [HardGamesWon] = @HardGamesWon WHERE [PlayerID] = @original_PlayerID AND [GamesPlayed] = @original_GamesPlayed AND [GamesWon] = @original_GamesWon AND [EasyGamesPlayed] = @original_EasyGamesPlayed AND [EasyGamesWon] = @original_EasyGamesWon AND [MediumGamesPlayed] = @original_MediumGamesPlayed AND [MediumGamesWon] = @original_MediumGamesWon AND [HardGamesPlayed] = @original_HardGamesPlayed AND [HardGamesWon] = @original_HardGamesWon">
6 <DeleteParameters>
7 <asp:Parameter Name="original_PlayerID" Type="String" />
8 <asp:Parameter Name="original_GamesPlayed" Type="Int32" />
9 <asp:Parameter Name="original_GamesWon" Type="Int32" />
10 <asp:Parameter Name="original_EasyGamesPlayed" Type="Int32" />
11 <asp:Parameter Name="original_EasyGamesWon" Type="Int32" />
12 <asp:Parameter Name="original_MediumGamesPlayed" Type="Int32" />
13 <asp:Parameter Name="original_MediumGamesWon" Type="Int32" />
14 <asp:Parameter Name="original_HardGamesPlayed" Type="Int32" />
15 <asp:Parameter Name="original_HardGamesWon" Type="Int32" />
16 </DeleteParameters>
17 <UpdateParameters>
18 <asp:Parameter Name="GamesPlayed" Type="Int32" />
19 <asp:Parameter Name="GamesWon" Type="Int32" />
20 <asp:Parameter Name="EasyGamesPlayed" Type="Int32" />
21 <asp:Parameter Name="EasyGamesWon" Type="Int32" />
22 <asp:Parameter Name="MediumGamesPlayed" Type="Int32" />
23 <asp:Parameter Name="MediumGamesWon" Type="Int32" />
24 <asp:Parameter Name="HardGamesPlayed" Type="Int32" />
25 <asp:Parameter Name="HardGamesWon" Type="Int32" />
26 <asp:Parameter Name="original_PlayerID" Type="String" />
27 <asp:Parameter Name="original_GamesPlayed" Type="Int32" />
28 <asp:Parameter Name="original_GamesWon" Type="Int32" />
29 <asp:Parameter Name="original_EasyGamesPlayed" Type="Int32" />
30 <asp:Parameter Name="original_EasyGamesWon" Type="Int32" />
31 <asp:Parameter Name="original_MediumGamesPlayed" Type="Int32" />
32 <asp:Parameter Name="original_MediumGamesWon" Type="Int32" />
33 <asp:Parameter Name="original_HardGamesPlayed" Type="Int32" />
34 <asp:Parameter Name="original_HardGamesWon" Type="Int32" />
35 </UpdateParameters>
36 <InsertParameters>
37 <asp:Parameter Name="PlayerID" Type="String" />
38 <asp:Parameter Name="GamesPlayed" Type="Int32" />
39 <asp:Parameter Name="GamesWon" Type="Int32" />
40 <asp:Parameter Name="EasyGamesPlayed" Type="Int32" />
41 <asp:Parameter Name="EasyGamesWon" Type="Int32" />
42 <asp:Parameter Name="MediumGamesPlayed" Type="Int32" />
43 <asp:Parameter Name="MediumGamesWon" Type="Int32" />
44 <asp:Parameter Name="HardGamesPlayed" Type="Int32" />
45 <asp:Parameter Name="HardGamesWon" Type="Int32" />
46 </InsertParameters>
47 <SelectParameters>
48 <asp:ProfileParameter Name="playerid" PropertyName="hangmanplayeridString" />
49 </SelectParameters>
50 </asp:SqlDataSource>
 

View 2 Replies View Related

SQL Server Is Terminating Due To &#39;stop&#39; Request From Service Control Manager

Nov 6, 2000

Hi

I have been getting this message in the event viwer and my SQL server goes down. I have to go and start the service once again. Can somebody throw some light as how to solve this problem?

Please respond.

Tks.

Zolla

View 3 Replies View Related

SQLSourceSafe, The Integrated Version Control Solution For SQL Server Objects!

Jul 20, 2005

SQLSourceSafe 2.0 is the right version control solution for SQL Serverdatabase development projects. SQLSourceSafe 2.0 Integrates with bothSQL Server and Visual SourceSafe, providing an effective andeffortless version control management system for individuals andproject teams to manage database objects.By using SQLSourceSafe 2.0, you can manage SQL Server database objectssuch as tables, stored procedures, user defined functions, views,triggers, indexes/keys and constraints as you manage regular files andprojects in SourceSafe. SQLSourceSafe 2.0 enables your to archive andlabel database object changes in SourceSafe, so that you can comparedifferent versions, recover from an undesired write-over of objects,or roll back to a previous release. Advanced users can also useSQLSourceSafe 2.0 to find out the differences between SQL Serverdatabases or deploy the latest or any labeled version SQL Serverdatabase archived in SourceSafe to different computers.For more information, please visit: http://www.bestsofttool.com.

View 1 Replies View Related

Unable To Display Server Reports In Report Viewer Control

Oct 14, 2007


Hi all,

I have been using the reportviewer control to display my ssrs reports. However, i'm facing issues in displaying Server reports in the control. The following error show up whenevr i click on View Report.

Execution 'aaxe3ke5k34l5355qbup0rvo' cannot be found



Please help if anyone has come across something similar

View 1 Replies View Related

Control Access To SQL Server 2005 Database Only Through Stored Procedures Issue

Apr 14, 2008


Hello,

I have a database (SQL 2005) with two schemas (dbo and s1) and with tables defined in dbo and tables defined in s1. The stored procedures are also defined in both schemas, some of them in dbo some of them in s1. Some of the stored procedures query tables from dbo and s1 at the same time.
I want to have a new db role with access to the database only through sps and no other access read/write to the tables. I created a new db role and granted execute permission to it and assigned a user to it.
When I execute stored procedure defined in dbo with query against dbo tables, it works as expected.
However, if I run stored procedure defined in s1 with query to table in dbo, I receive error about missing select permission for the table in dbo. I am not sure why, but I can assume there is an issue with the ownership chain.
I can grand read/write permission for the tables, but this will break our original requirement for limited access to the db only through sp.
The other option is to have another role r2, with read/write, privilege and to use EXECUTE AS r2 in the sp.

I would like to ask first why the error for missing select permission happens and is there another way to have role restricted to only execute permission for all stored procedures.

Thanks,
IT

View 5 Replies View Related

Analysis :: How To Structure Source Control Folders In Team Foundation Server

Jun 11, 2015

How to integrate current artifacts with TFS ?

For example : We have multiple applications X, Y, Z  each has  its own SSIS solution , SQL Script, MSTR report and documentation.

We move code from Dev to Test and then to PROD

How to structure the folders which will be easy to manage and easy to release ?

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved