Writing Files To A Database

Feb 7, 2007

Hi, I'm relatively new to SQL and ASP.NET and I'm after some assistance to what I hope is an easily achievable goal.

I need to upload some files (.pdf, .doc, .jpg - whatever) to a directory on my webserver. Once this has been done, I'd like to write some data to an SQL Database Table that will contain information about these files in a datagrid (or something similar) along with a link to download them.

E.g I upload car.jpg which is located at /images/secure/car.jpg and is a photo of car. When a user logs in, they will be shown a datagrid which pulls information from said SQL database and in this datagrid will be something like:

Filename     Description        Link

car.jpg        A pic of a car     Download

 

If anyone is able to help me out with regards to linking to a file from an SQL dB it would be greatly appreciated, and if you require any further information just let me know :)

 Ben.

View 2 Replies


ADVERTISEMENT

Problem Writing XML Files.

Sep 6, 2005

Hi guys,I have a stored procedure that I will subsequently post below thismessage. What the stored procedure does is, it reads some specifictables in a database and created XML off it.The problem comes in when the data is bigger than a few hundred/thousand characters. The data is truncated and the XML file is notfully made.Now i have been reading some posts by some people and tried using TEXT/NTEXT/ IMAGE type to write the files but they give me errors which,again, I am adding to this email.STORED PROC:****************************CREATE PROCEDURE usrp_sp_makexmlfile@str varchar(50),@templatefile varchar(255),@ReturnValue as image OUTASSET NOCOUNT ONDECLARE @strVar as varchar(8000)/*DECLARE @ReturnValue as varchar(255)*/Set @strVar = 'Select * from ' + @str + ' FOR XML AUTO'Set @templatefile = 'c: emplate.tpl'EXEC (@strVar)SELECT @ReturnValueGOTHIS IS WHAT I GET WHEN I USE IMAGE/NTEXT/TEXT TYPE:************************************************** *******An unhandled exception of type 'System.InvalidOperationException'occurred in system.data.dllAdditional information: Parameter 2: '@ReturnValue' of type: Byte[],the property Size has an invalid size: 0Also, if i try to add an integer value to the image/text/ntext like8000 or something less than that, it tells me that the result has to bediscarded because the current process has had some error.Can someone give me a suggestion on how to resolve this or an examplethat would illustrate the solution? Thank you all in advance.Pi.

View 3 Replies View Related

Writing SQL Data To XML Files

Sep 7, 2005

Hi guys,I have been trying to write data from a database to XML files andalthough i have been successful in doing that, the file(s) that are madeare not of the form that I would want.I am using:SQLDataSet.WriteXml(strFileName, XmlWriteMode.WriteSchema);to generate the files where strFileName is the name of the file. Thefiles when viewed with XML Editor are seen as lines of data instead ofthe regularly generated XML where each row is one below the other. Whenviewed with WordPad/Notepad i see elements />< betweeen the dataand somehow I think this has to do something with the problem.Can someone help me with this?? Any help or suggestion would be greatlyappreciated.Thanks.*** Sent via Developersdex http://www.developersdex.com ***

View 2 Replies View Related

Writing Huge Files From CLR

Dec 20, 2006

Hi

Coming straight to the problem -

I need to write text files of the size more than 1GB! First thought of doing this with BCP but then fetching data from stored proc was taking too long (more than one hour) and so BCP did not seem to be the right option as we have less flexiblity in terms - handling errors, knowing the status as to what point the writing has been complete etc. Most importantly getting such a huge amount of data did not seem to be a one time job! So I am now thinking about writing a CLR procedure which fetches smaller amount of data at a time and writing to file. Something like - open connection, get data, close connection, write to file and continue in cycles of this till whole file is written. Does this makes sense considering the amount of data to be fetched?

Any suggestion/comment on this will be much helpful!

View 4 Replies View Related

Incremental Output In QA And Writing To Files

Jul 20, 2005

Hi;Before I start let me say I know this is a silly way to go aboutthings, but it is one of those "my company made me do it" things.My company is in the process of ( finishing ) migrating from foxpro tosqlserver.They have a foxpro program that does a lot of various updates. Iwould like to write a tsql script to replace it.The trick is that the tsql script would have to have some proceduralprogramming artifacts that I don't think it has.I/my company would like the script to generate output messages thatthe user can see while the script is running. Everytime I have ran ascript in query analyzer I usually don't see the output ("print"statemetns, etc ) until all of the work isdone. Is there a way to run thing so I can see the output statementsas the work is being done?Can print statements work from within a tsql loop?The other thing is that I/my company wants the tsql script to writeoutput messages to a log file while it is operating ( for errorchecking and other logging).Is this possible with tsql?Thanks in advance for the infoSteve

View 1 Replies View Related

Writing Into Text Files In SSIS

Aug 18, 2006



I am having a scenario where all the stored procedures are stored in a folder (one sql file per sproc). Stored procedure does not have 'IF Exists .... DROP Procedure' in the script so before creating them we have to drop all sproc manually.

Can anyone help me writing a script / SSIS process to loop through each file in folder and write "IF EXISTS ... DROP PROCEDURE" with the procedure name in it ??

I can create a package that loop through each file in FOR each Loop task but dont know how to write in file using .net

Thanks in advance

Furrukh baig

View 3 Replies View Related

Writing Variables On Flat Files

Aug 3, 2007

Hi,
I'm trying to write the content of variables on flat files... is that possible?

Thanks!

View 7 Replies View Related

Reading/writing Files To Network Drive

Mar 20, 2007

We have a package that is using a ForEach loop container to access files on a network drive. For some reason I am getting a message that the ForEach enumerator is empty and did not find any files that matched the pattern. For the pattern I left the default *.* for testing purposes. I have specified the file folder as \remoteserverfilesharesubfolder and also as \remoteserverc$filesharesubfolder and have gotten the same message. However when I map a network drive and set the file folder to the network drive it finds the files. Is this a permissions issue?

After I finish processing the file I want to move it to a new directory. Once this is deployed in production, the package will not be running under a domain account and probably won't have access to the network folder. Is there any way to specifiy in the connection manager itself that it should use a specific account to access the folder?



TIA,

Sabrina

View 1 Replies View Related

Writing A DTXS Package To Extract 50 Tables To 50 Text Files?

Nov 26, 2007

Is there a quick way to extract a full dump of 50 tables to 50 corresponding text files?


i.e.

table_a has to be extracted to table_a.txt

table_b has to be extracted to table_b.txt

table_c has to be extracted to table_c.txt
etc.

I don't want to have to add each one separately by hand in the DTSX package designer.
I can't see any way to do it in a loop (because you have to do the field mapping).
I can't seem to get the DTS Wizard to help - it only seems to be able to handle one table-to-text extract at any one time.
And I've tried editing the DTXS file directly (in XML) but it looks like it's going to be rather complex, even if I only do it to define the connection managers.
Feel free to suggest any better way to do this, though the specification has already been agreed, so I'm unlikely to be able to change it.
Thanks

View 3 Replies View Related

Writing Sqlcmd Batch Files To Do Bulkfile Copies Or Imports

Sep 23, 2007

I want to write a batch file that will do just that. The problem is bcp or bulkcopy never works with my code, it doesn't recognize it. Maybe I'm going the wrong way to do this, but I could use some help. Ideally I'll make the batch to do the importing via bulkcopy or something like it of a text file into a table and use windows scheduler to automate it. Be as specific as you can please, I'm very new to sql server.

View 6 Replies View Related

Writing To Database

Feb 4, 2008

 hi, I'm trying to write to a database from a web page. The code is throwing back no errors but it just isn't writing to the database. Am I missing something? void SubmitDetails(Object s, EventArgs e)    {        SqlConnection objConn = new SqlConnection(ConfigurationManager.AppSettings["ConnectionString"]);        SqlCommand objCmd;                objCmd = new SqlCommand(            "INSERT INTO Member_Information (Name, Address_Line_1, Address_Line_2, Address_Line_3, Email_Address, Contact_Number, " +            "Password, Name_Of_Bank, Account_Number, Sort_Code, Bank_Address_Line_1, Bank_Address_Line_2, Bank_Address_Line_3) " +            "VALUES (@Name, @Address_Line_1, @Address_Line_2, @Address_Line_3, @Email_Address, @Contact_Number, " +            "@Password, @Name_Of_Bank, @Account_Number, @Sort_Code, @Bank_Address_Line_1, @Bank_Address_Line_2, @Bank_Address_Line_3)", objConn);        objCmd.Parameters.AddWithValue("@Name", txtName.Text);        objCmd.Parameters.AddWithValue("@Address_Line_1", txtAL1.Text);        objCmd.Parameters.AddWithValue("@Address_Line_2", txtAL2.Text);        objCmd.Parameters.AddWithValue("@Address_Line_3", txtAL3.Text);        objCmd.Parameters.AddWithValue("@Email_Address", txtEmail.Text);        objCmd.Parameters.AddWithValue("@Contact_Number", txtContact.Text);        objCmd.Parameters.AddWithValue("@Password", txtPassword.Text);        objCmd.Parameters.AddWithValue("Name_Of_Bank", txtBank.Text);        objCmd.Parameters.AddWithValue("Account_Number", txtAN.Text);        objCmd.Parameters.AddWithValue("@Sort_Code", txtSort.Text);        objCmd.Parameters.AddWithValue("@Bank_Address_Line_1", txtBA1.Text);        objCmd.Parameters.AddWithValue("@Bank_Address_Line_2", txtBA2.Text);        objCmd.Parameters.AddWithValue("@Bank_Address_Line_3", txtBA3.Text);        objConn.Open();        objCmd.ExecuteNonQuery();        objConn.Close();    }   

View 4 Replies View Related

Writing MDF To SQL Database

Oct 6, 2006

Hi,

I've been searching the internet for hours and the code i'm finding is just not what i'm wanting to do. Heres the story, I have a database file "MyDatabaseFile.mdf" I am making a form when you click a button I want it to create the "MyDatabaseFile.mdf" in MS SQL Server. Is this possible if so how?

I it something like "CREATE DATABASE MYNAME?". I jsut want the MDF file i dont want the log file inserting or anything. Is there any tools out there that anybody can recommend that will help me with T-SQL?

 

Cheers,

Rob

View 6 Replies View Related

Writing To SQL Database

Dec 15, 2005

I am trying to write to the Express SQL database using the My Movie Collection sample in VS2005. It seems to work fine while the program is running but when I restart the application all of the entries in the database are gone.
 
What do I need to do to actual put the data in the database?
 
Thanks

View 1 Replies View Related

Update Not Writing To Database

Sep 21, 2006

Hello, I am trying to update a few records in my table everything seems to work fine when I hit the submit button. But it does not acutally end up writing to the database... Can someone tell me if they see anything wrong with what I have for code? public void SaveData(){//declare sql connectionSqlConnection SQLConn = new SqlConnection();SQLConn.ConnectionString = base.m_CharterBase.GetSiteKey("EDCCConnectString");SqlCommand Cmd = new SqlCommand();//Open Connections SQLConn.Open();//Set command propertiesCmd.Connection = SQLConn;Cmd.CommandText ="Declare @ID as Int " +"UPDATE [TD_FSCL_PayPeriod] " + "Set [Quota] = @Quota, [LastChangeDate] = getdate(), [LastChangeID] = @LastChangeID, [LastChangeBy] = @LastChangeBy " + " where [ID] = @ID"; //Set parameter valueSqlParameter parmQuota = new SqlParameter();parmQuota.DbType = DbType.Int16;parmQuota.ParameterName = "@Quota";parmQuota.Value = txtQuota.Text; SqlParameter parmLastChangeID = new SqlParameter();parmLastChangeID.DbType = DbType.Int32;parmLastChangeID.ParameterName = "@LastChangeID";parmLastChangeID.Value = Master.curUser.User_ID;SqlParameter parmLastChangeBy = new SqlParameter();parmLastChangeBy.DbType = DbType.String;parmLastChangeBy.ParameterName = "@LastChangeBy";parmLastChangeBy.Value = Master.curUser.Domain_Login; //Add to parameters collectionCmd.Parameters.Add(parmQuota);Cmd.Parameters.Add(parmLastChangeID);Cmd.Parameters.Add(parmLastChangeBy); //Fire the queryCmd.ExecuteNonQuery();//Close ConnectionSQLConn.Close();}  protected void btnSubmit_click(Object sender, EventArgs e){// run save method and then clear methodSaveData();clear_page();}

View 2 Replies View Related

Issue Writing To Database

Mar 11, 2008

I am having an issue connecting to my database. I have copied the code below. I get no error messages, but my data is not getting written to the database. Can anybody help me figure what I am doing wrong. This is my first attempt at doing this in .NET. Thanks.
 <%@ Page Language="VB" %>
<script runat="server">

Protected Sub btnFileUpload_Click(ByVal sender As Object, ByVal e As System.EventArgs)

Try


' Get the HttpFileCollection

Dim hfc As HttpFileCollection = Request.Files

For i As Integer = 0 To hfc.Count - 1

Dim hpf As HttpPostedFile = hfc(i)

If hpf.ContentLength > 0 Then

hpf.SaveAs(Server.MapPath("MyFiles") & "" & Path.GetFileName(hpf.FileName))

Dim strConn As String = "Provider=SQLNCLI;Server=.SQLExpress;AttachDbFilename=|App_Data|tblFiles.mdf; Database=tblFiles.mdf;Trusted_Connection=Yes;"
Dim strsql As String = "InsertCommand=INSERT INTO [PruFiles] ([TheFileName]) VALUES ('" & hpf.FileName & "')"
Dim myconn As New OleDbConnection(strConn)
Dim myCommand As New OleDbDataAdapter(strsql, myconn)

End If

Next i

Catch ex As Exception

' Handle your exception here

End Try


End Sub

</script>
<!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 runat="server">
<title>ASP.NET 2.0 FileUpload Control Sample</title>

<link rel="stylesheet" type="text/css" media="screen" href="Stickman.MultiUpload.css" />

<script src="mootools.js"></script>
<script src="Stickman.MultiUpload.js"></script>
<script type="text/javascript">
window.addEvent('domready', function(){
// Use defaults: no limit, use default element name suffix, don't remove path from file name
new MultiUpload( $( 'myForm' ).myFileUpload );
});
</script>

</head>
<body>
<form id="myForm" runat="server">
<div>
<asp:FileUpload ID="myFileUpload" runat="server" />
<asp:Button ID="btnFileUpload" runat="server"
Text="Upload File"
OnClick="btnFileUpload_Click"
/><br />
<span id="Span1" runat="Server"></span>
</div>
<p>
 </p>
<p>
 </p>
<p>
 </p>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
DeleteCommand="DELETE FROM [PruFiles] WHERE [FileID] = @FileID"
InsertCommand="INSERT INTO [PruFiles] ([FileID], [TheFileName]) VALUES (@FileID, @TheFileName)"
SelectCommand="SELECT * FROM [PruFiles]"
UpdateCommand="UPDATE [PruFiles] SET [TheFileName] = @TheFileName WHERE [FileID] = @FileID">
<DeleteParameters>
<asp:Parameter Name="FileID" Type="Object" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="TheFileName" Type="String" />
<asp:Parameter Name="FileID" Type="Object" />
</UpdateParameters>
<InsertParameters>
<asp:Parameter Name="FileID" Type="Object" />
<asp:Parameter Name="TheFileName" Type="String" />
</InsertParameters>
</asp:SqlDataSource>
</form>
</body>
</html>
 Also here is my web.config file:

<configuration>
<configSections>
<sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
<sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere"/>
<section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
<section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
<section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/></sectionGroup></sectionGroup></sectionGroup></configSections><appSettings/>
<connectionStrings>
<add name="ConnectionString" connectionString="Data Source=.SQLEXPRESS;AttachDbFilename=|DataDirectory| blFiles.mdf;Integrated Security=True;User Instance=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
<system.web>
<httpRuntime
executionTimeout="200"
maxRequestLength="102400"
requestLengthDiskThreshold="256"
useFullyQualifiedRedirectUrl="false"
minFreeThreads="8"
minLocalRequestFreeThreads="4"
appRequestQueueLimit="5000"
enableKernelOutputCache="true"
enableVersionHeader="true"
requireRootedSaveAsPath="true"
enable="true"
shutdownTimeout="90"
delayNotificationTimeout="5"
waitChangeNotification="0"
maxWaitChangeNotification="0"
enableHeaderChecking="true"
sendCacheControlHeader="true"
apartmentThreading="false"/>
<compilation debug="false" strict="false" explicit="true">
<assemblies>
<add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/></assemblies></compilation>
<pages>
<namespaces>
<clear/>
<add namespace="System"/>
<add namespace="System.Collections"/>
<add namespace="System.Collections.Specialized"/>
<add namespace="System.Configuration"/>
<add namespace="System.Text"/>
<add namespace="System.Text.RegularExpressions"/>
<add namespace="System.Web"/>
<add namespace="System.Web.Caching"/>
<add namespace="System.Web.SessionState"/>
<add namespace="System.Web.Security"/>
<add namespace="System.Web.Profile"/>
<add namespace="System.Web.UI"/>
<add namespace="System.Web.UI.WebControls"/>
<add namespace="System.Web.UI.WebControls.WebParts"/>
<add namespace="System.Web.UI.HtmlControls"/>
<add namespace="System.IO"/>
<add namespace="System.Data.OleDb"/>
</namespaces>
<controls>
<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/></controls></pages>
<!--
The <authentication> section enables configuration
of the security authentication mode used by
ASP.NET to identify an incoming user.
-->
<authentication mode="Windows"/>
<!--
The <customErrors> section enables configuration
of what to do if/when an unhandled error occurs
during the execution of a request. Specifically,
it enables developers to configure html error pages
to be displayed in place of a error stack trace.

<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>
-->
<httpHandlers>
<remove verb="*" path="*.asmx"/>
<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add verb="GET,HEAD" path="ScriptResource.axd" validate="false" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/></httpHandlers>
<httpModules>
<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/></httpModules></system.web>
<system.codedom>
<compilers>
<compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CSharp.CSharpCodeProvider,System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" warningLevel="4">
<providerOption name="CompilerVersion" value="v3.5"/>
<providerOption name="WarnAsError" value="false"/></compiler>
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" warningLevel="4">
<providerOption name="CompilerVersion" value="v3.5"/>
<providerOption name="OptionInfer" value="true"/>
<providerOption name="WarnAsError" value="false"/></compiler></compilers></system.codedom>
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<modules>
<remove name="ScriptModule"/>
<add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/></modules>
<handlers>
<remove name="WebServiceHandlerFactory-Integrated"/>
<remove name="ScriptHandlerFactory"/>
<remove name="ScriptHandlerFactoryAppServices"/>
<remove name="ScriptResource"/>
<add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add name="ScriptResource" verb="GET,HEAD" path="ScriptResource.axd" preCondition="integratedMode" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/></handlers></system.webServer>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/></dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Extensions.Design" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/></dependentAssembly></assemblyBinding></runtime></configuration>
 

View 6 Replies View Related

Help Me In Writing The Code In Database

Jun 6, 2008

Hi Friends, Please any one help me in writing the code in thisI have 3 fileds1)empId-->textbox2)Roles-->4 radiobuttons(MN,PL,TL,CL)3)Responsibilities--->3 check boxes(profile,register,change password)I have 3 tablestable1:RoleMasterTable:roleID        roleName1              MN2               PL3               TL4              CLtable2:ResponsibilityMasterTableresId      resName1           profile2          register3          changepasswordtables3MasterTable:empId          roleId     resIdthe form conatains the empId,Roles(radiobuttons),Responsibilies(chechboxes)for example  I have to enter empId=1select one radiobutton that is "PL"and I can select check boxes profile,register and manyafter submitting the button("submit) these details has to store in the database table i.e master tableI have to show the final o/p like this in the tableMasterTableempId     roleId    resId1              2           1,2Please any one help in this I am beginner in database c# programmingPlease its very helpful to me............Thanks & RegardsGeeta                

View 7 Replies View Related

ERROR When Writing To The Database

Apr 25, 2005

Hi
i get the following error whe writing to the db, what does it mean?
System.Data.SqlClient.SqlException: An explicit value for the identity column in table 'tbl_StudentInfo' can only be specified when a column list is used and IDENTITY_INSERT is ON. at System.Data.SqlClient.SqlCommand.ExecuteNonQuery() at ASP.Applicationform2_aspx.populateDb() in http://localhost/iris/Applicationform2.aspx:line 84

i am using the following code:

mycon.Open();

//string qry="insert into tbl_StudentInfo values ('"+Request.QueryString["Id"].ToString()+"','"+Request.QueryString["nam"].ToString()+"','"+Request.QueryString["surNa"].ToString()+"','"+Request.QueryString["DOB"].ToString()+"','"+Request.QueryString["addr"].ToString()+"','"+Request.QueryString["pCode"].ToString()+"','"+Request.QueryString["Cntry"].ToString()+"','"+Request.QueryString["email"].ToString()+"','"+Request.QueryString["ph"].ToString()+"','"+qualification+"','"+stdGPA+"','"+stdYear+"','"+Institute.Text+"','"+Tof.Text+"','"+subject+"','"+prrof.Text+"','"+""+"','"+todayDate+"')" ;
string qry="insert into tbl_StudentInfo values ('"+Request.QueryString["Id"].ToString()+"','"+Request.QueryString["nam"].ToString()+"','"+Request.QueryString["surNa"].ToString()+"','"+Request.QueryString["DOB"].ToString()+"','"+Request.QueryString["addr"].ToString()+"','"+Request.QueryString["pCode"].ToString()+"','"+Request.QueryString["Cntry"].ToString()+"','"+Request.QueryString["email"].ToString()+"','"+Request.QueryString["ph"].ToString()+"','"+qualification+"','"+stdGPA+"','"+stdYear+"','"+Institute.Text+"','"+Tof.Text+"','"+subject+"','"+prrof.Text+"','"+""+"','"+todayDate+"','"+RequestYear+"','"+""+"','"+""+"','"+"0"+"')" ;
myCommand = new SqlCommand(qry,mycon);
myCommand.ExecuteNonQuery();Response.Redirect("main.aspx");
}
catch(Exception e)
{
Response.Write(""+e);
}
the red line is line 84
PLEASE HELP

View 1 Replies View Related

Tell If Application Is Writing To Database?

Jan 12, 2015

I was all set to build some triggers on some modified date tables when in the last minute I found out that the application (built in C#) was controlling the after update trigger.

Is there a tool you can use in SSMS to see if there is a connection set up like this?

View 7 Replies View Related

Is There A Delay Writing To An SQL Database

Apr 16, 2007

Can someone advise if there is a delay in data being written to the database following a tableadapter.update(datatable) command?

I save transactions which are subjected to the above and then a listview is updated to reflect them.

As I work through all is OK and the transactions appear in view.

I then run a backup through my app using a backup object to do this and this reports all OK

I then close the app and re-open and as as I am in debug the database is empty.

I perform a restore through my app using a restore object and selecting the backup file I created previoulsy which reports all OK

The retore procedure calls application.restart to allow the app to initialise to the restored data.

The problem is quite a bit of my data in missing from the restore as if the last block I did prior to backup never actaully made it to the database?

I also rememeber noting that at times when the update method is performed the actual timestamp on the physical databse is not updated....until I close the app and return to the designer?

So does this mean then prior to performing a backup I have to somehow force the app to ensure it has written all changes to the databse?

Thanks

View 3 Replies View Related

Trouble Writing To A Database

Nov 13, 2007

I am trying to write to a database through C++ with the ODBC stuff. I can connect to and close the database as well as write certain things to it. I am having trouble writing strings or chars to it though. I'm not really a DB programmer and probably won't have to do it in C++ for a long time, so I'm just looking for some quick help so I can move on to other stuff. I know this code probably won't look right either since I;ve only seen this stuff for about 2 days now. Basically I have a string that I want to bind using SQLBindParameter so that I can use it in an ExecDirect statement. Basically when I run the little code snippet below, it writes some crazy character set out. Any help would be appreciated because I really have no clue what I'm doing.


SQLCHAR test1 = 'a';
SQLINTEGER test = SQL_NTS;

retcode = SQLBindParameter(hstmt, 1, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR,0,0,&test1, 0,&test);

View 1 Replies View Related

Writing Directly To A Database Using An SqlDataSource

Jan 31, 2008

Hey all Im trying to make a system in which users logged on can change their password. I dont want to use a grid view because that dosent give me the chance to let them put in their old password first for validation but now I need a way of takeing data out of the textbox with the new password and placeing it in to the field in a database.As I stand at the moment I have a data.dataview variable equal to an SQL Data Source with my query in it, bringing back a record from a users table with the users username, password and a field stating what type of user they are. It filters this by username which is stored as a session variable and username is the primary key. there is then an if statement checking that the string in the password field is equal to what the user has written in the old password box and if they match it uses the command:dv.Table.Rows(0)(1) = txtNewPassword.TextMsgBox("Password Successfully Changed", MsgBoxStyle.Information)When I run this the validation successfully checks the password is correct and then displays the message box saying the password is correct but it hasnt actually changed it. Somone I know told me that I need to use the command sqldatasource.update but I cant see where it fits in. Anyone got any ideas? 

View 2 Replies View Related

Writing Data From XML File To Database

Feb 16, 2008

Hi Guys
 In my project I need to write the data from an xml file to Database through a stored precedure.
On line a lot of help is available for writing data from Database to xml but I didnt see much info
about writing xml to database.
If any one could give me some code I will really appreciate it.(I am a newbee).
This application is developed using asp.net 1.1 and sql server 2005.
Thanks for your help in advance.
 

View 3 Replies View Related

Reading Or Writing A File To A SQL Database

Nov 22, 2004

Halo, I am a bit new to this
Please can someone help me, I would like to write a file(Any type) to a SQL database like a attached document(s) for the current record and be able to detatch the document when needed.
I use VB.NET for a ASP.NET app.
I basicly would like to attach documents to a piece of equipment may it be any kind and if the user views the equipment he will be able to detatch the documents for that piece of equipment and open it with the correct software.
PLEASE HELP!!!!!!!

View 1 Replies View Related

Problems Writing A String To An SQL Database

Mar 17, 2006

Hi Forum,
 
I am having a problem writing string values to my SQl database. I have the following code:
 
Dim pItemDescription As New SqlParameter("@itemdescription", o.ItemDescription)
cmdOrderDetails.Parameters.Add(pItemDescription)
 
o.Item Description returns the full string as a parameter but when it is written to the database it only writes the first letter in the database field. The column is set up as a VARCHAR with a a field length of 50 which is more than enough. Is there something I am doing wrong or missing out?
 
Thanks
Rich

View 1 Replies View Related

Reading/Writing Data From A SQL Database

Feb 14, 2008



Hi,
I have a data structure called 'Quote' which contains a number of different variables and controls ranging from text boxes, check boxes and radio buttons, i need to be able to read and write this from a database.

First I think a description of my overall project is needed:



Project Description
I have been given a brief that basically says: i have to create a programmed solution in VB to solve a problem. This problem can be anything we like, and I personally have chosen to create a program that manages quotes for building Log Cabins (this is very contrived and far from anything someone would do in the real world).

My solution will allow a generic user to create a quote (using a form with controls such as text boxes, check boxes, radio buttons) , and then save this to file. These users may then wish to load/edit this quote at a later date, from another form.

Whilst completing this project, i'll only have up to about 5 records (quotes) within the system, so i dont need the ability to store hundreds of records. And each record will be relatively short, with only about 10-15 data items within the data structure.

Also the Admin (or business owner in this case) need to be able to view all saved quotes in a presentable format, and edit them if needs be, from within this same program.

This solution does not need to be absolutely perfect and 100% efficiently coded, or have all the bells and whistles a real-world program would have. This is for an A level computing project by the way.





So basically, i need to be able to read from the database (to populate a Data Grid (i imagine this is best way?)) and so Admin can access any quote and edit it (editing is not vital, but viewing/printing is. Maybe i should stop at just viewing any quote?). Also i need generic users to be able to fill in the Edit Quote form and then save this data into the database.

And is a data structure really required for me to use a database?

I've never used databases in VB before (but have used them elsewhere, mainly Access) and so am completely new to this. Any help will be much appreciated.
Thanks

View 13 Replies View Related

Issue With OLE DB Command While Writing To DB2 Database

May 16, 2007

Hi,

I have created a package which uses the OLE DB Command as the target where I write the sql command to insert data into the table. The issue which I am facing is, while at the OLE DB COmmand , the package fails. I notices that it is not able to get the input columns which are mapped to the target columns.



The same package works fine when the target is on Oracle database or a SQL Server database.



For DB2, i have tried using the Microsoft OLE DB Driver for Db2, as the IBM DB2 Driver doesnt work for insert properly.



Any suggestion regarding this would be really helpful.



Thanks,

Manish

View 2 Replies View Related

Database Automatically Writing To App_data Folder

Feb 28, 2008

Hello!
I have created my self a person website in VS2008 using Linq and ahev downloaded a copy of sql express to use as my database when working on it at home.
I have just noticed, now I am trying to upload it to a server that my sql express is automatically creating the database in my app_data folder, this is causing me problems, as I don't want it to do this. I want it to be able to point it at a full version of SQL server.
 Is there some setting I have missed? Of how can I stop tis automatic creation of the database?
Thanks
Bex 

View 1 Replies View Related

Writing To A Text File From A Database Query.

Jul 20, 2005

I need to just back one table and not all the data in the table. Is there away to have SQL save the data return from a query to some text file that Ican then use to build the table in another table on another server?I am SQL server 7Thanks,S

View 1 Replies View Related

Database Level Triggers In SQL 2000? File Writing?

Oct 17, 2007

Hello,
Is there any ability to do database-level triggers in SQL 2000?  I have a SQL 2000 database, and I was asked if we could create a trigger that whenever anyone touches the data in a database, to create an entry in an event log?  If not, I have a main table I can put a trigger on; however, my question is how do you write to a file in a trigger as well?
Thanks.

View 2 Replies View Related

Different Behaviors When Writing Database File Into The SD Memory Card.

Feb 21, 2007

Hi All,

I have seen some different behaviors when I am writing SQL Server compact edition Database file into SD Memory card or any user removable storage media.

The following Steps for reproducing these behaviors.

1. Set your database location is in the SD Memory card.
2. Create a database and establish session.
3. Writing first record into the database is done
4. Remove your SD card manually from the system
5. Try to write a Second record into the database
6. You will get the error from this "SqlCeWriteRecordProps" API call - This is fine.
7. Put your SD card back into the system.
8. Writing Second record again into the database is done - This is fine.

So far the behaviors are good after that

9. Remove your SD card manually from the system again
10. Try to write a Third record into the database
11. You will suppose to get the error from this "SqlCeWriteRecordProps" API call but you won€™t get that error €“ I don€™t know why?
12. Then Try to write a Forth record into the database
13. You won't get any error from the API call "SqlCeWriteRecordProps" and return status is success.
14. Now put your SD card back into the system.
15. Then write Fifth record but this time its writing record Third, Fourth and Fifth into the database.

Note:
I am clearing (means Free) my record structure everything after calling this function "SqlCeWriteRecordProps". So I don€™t know why its wring Third, fourth and fifth record into the database.

Please Let me know your feedback.

Thanks,
Rajendran

View 1 Replies View Related

Writing Query To Dynamically Select A Database Table

Sep 24, 2006

Is there a way I can write a query to dynamically select a database table. That is, instead of having a variable for a certain column like customerId which would be €ścustomerID = @customerID€? I want to use the variable to select the table. I assume I may have to use a stored procedure but I am unclear as to how this would be coded.

Thanks

View 1 Replies View Related

Writing Binary Data To Database Only To Refrence A File Location?

Sep 29, 2006

Hey everyone I've got this question that has me stuck for the last few days but its an important part of my website.....What I am trying to do is basicly have a user be able to upload a file, have that uploaded file plus some other info automaticly display on other parts of my site, and have a different user eventually be able to download that file....I have thought about allowing the file upload as a BLOB but still cannot find a proper way to execute this using VB, plus I have heard that this way of doing it is not reccommeneded cause databases were not designed to store large files like this, lots of articles recommened having the file upload to a Folder on your server then get the binary data for the file that can be placed in a database to refrence that particular file.....Well this also proves to be a lot harder then said here is what I got so far (written in C#) protected void UploadBtn_Click(object sender, EventArgs e)
{
if (FileUpLoad1.HasFile)
{

FileUpLoad1.SaveAs(@"C:Documents and SettingsAdamMy DocumentsVisual Studio 2005ProjectsWebsiteFiles" + FileUpLoad1.FileName);
Label1.Text = "File Uploaded: " + FileUpLoad1.FileName;
}
else
{
Label1.Text = "No File Uploaded.";
}
}
and here is the asp part of the code that goes with it<asp:FileUpLoad id="FileUpLoad1" runat="server" />

<asp:Button id="UploadBtn" Text="Upload File" OnClick="UploadBtn_Click" runat="server" Width="105px" />

<asp:Label ID="Label1" runat="server" Text=""></asp:Label>
 Now from what I know is I need to get the binary of the file which I have read you can do with the Page.Request.Files statement but again not sure how I would impliment this.  Does anyone have any suggestions on which way I should take when dealing with this should I try and just use the BLOB method or use the binary refrence method? and if so how would I impliment this, heck even some good tutorials on the subject would be great... Thanks.....Adam

View 8 Replies View Related

How Can I Retrieve Data From A SQL Database Writing SQL Characters ( * , ? , [] ) In A Textbox Within My Form?

Nov 12, 2007



let's say I have a table named "myTable" in a SQL database:





UniqueID
FirstName
FamilyName

1
Elizabeth
Moore

2
Chris
Lee

2
Robert
McDonald's



I want to create a SQL query should contain a parameter for example:
SELECT * FROM myTable WHERE UniqueID = @TextBox OR FirstName = @TextBox OR FamilyName = @TextBox,


and when I type in my TextBox the ' * ' character, it should retrieve the whole table...

hope anybody understood, will be happy to explain more.

View 4 Replies View Related







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