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.Text
MsgBox("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
ADVERTISEMENT
Jun 16, 2004
i have a query and i would like to write the contents of the dataset out directly to a file and not bother with creating another temp table and then exporting it with a command with a dts to a csv file.
it is a type of reporting that i am trying to do
but i just need to export the raw data i retreive from the query
View 3 Replies
View Related
Mar 7, 2007
First let me give you a little back ground on me. I'm very new to the ASP, ASP.NET, Visual Studio, Sql Server, Frameworks....thing. I am coming over from a PHP/MySql background of over 5 years. The change over to VBScript and VB has been to tough and I have a basic liking for the Visual Studio 2005 and the ease of putting things together. However, I have come across something that to me seems like it should be relatively simple, but haven't been able to find the documentation or samples to describe what I'm looking to do.
Rough Need:
1. Start with a form will a couple labels and a singe textbox to get the lookup date from an user.
2. Query one table/view based on the users choice of date and select only one field of returned data.(Doing this by itself is not a problem and I can display my results in a Gridview, but this is where it starts getting tricky and the gridviews won't work for me.)
3. If there is something returned, I need to start a HTML table layout or possibly some form of a Gridview(I don't see how I would use the Gridview) and start a loop, adding the first returned row from this query into the first cell.
4. Now, based on that same User Date and the returned row value from the previous query, I need to query another Table/view and return another single field, which might return 1 or multiple rows, which I need to start a loop to display unique items in cells under the first on above.
5. Based on the original User Date and each returned row from the first query, I need to query two other Table/views and get some additional information. 4-5 fields will be returned and be displayed on one row in the number of necessary columns.
6. This would finish the first row from the first query, so I would need to loop back up to see if there were any further results and continue looping until the get to the last of the results from the first query.
7. Finally, I would just need to close up the Table/gridview.
The basic results I'm looking for would be similar to the following:
Results for 10/11/2005
Field name 1
Field name 2
Field name 3
Field name 4
Field name 5
First Result from query 11 of 4 results from Query 2, but only 1 unique result
Info from Query 3
Info from Query 3
Info from Query 3
Info from Query 4
Info from Query 4
Info from Query 3
Info from Query 3.
Info from Query 3
Info from Query 4
Info from Query 4
Info from Query 3
Info from Query 3
Info from Query 3
Info from Query 4
Info from Query 4
Info from Query 3
Info from Query 3
Info from Query 3
Info from Query 4
Info from Query 4
Second Result from query 1First result from Query 2 after looping though the first query Second result from Query 2 after looping though the first query
Info from Query 3
Info from Query 3
Info from Query 3
Info from Query 4
Info from Query 4
Info from Query 3
Info from Query 3.
Info from Query 3
Info from Query 4
Info from Query 4
Info from Query 3
Info from Query 3
Info from Query 3
Info from Query 4
Info from Query 4
Info from Query 3
Info from Query 3
Info from Query 3
Info from Query 4
Info from Query 4
It seems me from what I have read and slowly figuring out, is that I should be able to directly access the DataSet returned by four SqlDataSources, one for each of the above querys and then just write my own VB to handle the necessary looping, table format and such. I can easily add the for SqlDataSources to the page and add a Gridview for each one and get 4 separate chunks of info, but can't see a way with GridViews to intermingle the info like displayed above.
So, if it can be done with Gridviews, then I would love to see how that is done. But, if someone could explain to me how I access the DataSets directly that I get from the 4 SqlDataSources, then that would be ok too. I have figured enough out with VB, that I can write the code to do my looping requirements, if I can just access the information I get back. Thanks for reading all the way through this long post.
Jack
View 1 Replies
View Related
Aug 31, 2006
This is a subset question of one of my other threads, the gist is while using forms authentication, I am trying to enter additional information into another table on the same db as the aspnet_membership tables. I think I need an <asp:SqlDataSource> to do this because it is about the only thing left I haven't tried to get this code to work so any help is appreciated. Environment: sql server 2000, windows server 2003, asp.net 2.0, vb, no GUI<ASP:SqlDataSource id="addedInfo" ConnectionString="<%$ ConnectionStrings:SqlServerConnection %>" InsertCommand="INSERT INTO addInfo(username,email,company,firstname,lastname,phone) VALUES (@username,@email,@company,@firstname,@lastname,@phone)" runat="server" />looking over some of my books and online it says in the connectionStrings that it is supposed to be the database name that goes next to the : but when I try that I get an error that it is looking for the name of the connection string, so I enter the name of the connection string (as above) and nothing happens, which is basically the ongoing event with this whole problem, the form fields (username, email, password) that go into the aspnet_membership tables just fine, I don't have any problems with those, it is getting the additional information into another table that has been stalling me the whole time.So does this sqldatasource look right? Any help is appreciated.
View 12 Replies
View Related
Sep 10, 2012
We have a SQL database that uses Active Directory with Windows Authentication. Can users that are members of the Active Directory group that has read/write access to the SQL database create ODBC connections to access the database directly and update the data? They dont have individual logins on the server. They are only members of the Active Directory group that has a login?
View 1 Replies
View Related
Mar 19, 2015
I have an existing XY database which has tables and triggers , I have a new updated DDL scripts which I have deploy on XY database. Every week I will be updated with new DDL scripts which I have to deploy on database dropping all existing tables.
Currently I am dropping all the tables  and then copying all tables script to one and executing it.
My Que: Is there a way to automate the DDL scrips deploy on database directly?
First drop all tables and then create new tables.Â
View 6 Replies
View Related
May 7, 2008
hi lads,
what i need to do for my project are as following:
a mobile user send data via GPRS to SQL server Database. then i need to have a method to detect while a particular table is being inserted. and then extract data from table construct a report dynamiclly. what should i do to achieve this goal? e.g. window application, store procedure or trigger ?
PS : client side is a mobile application developed using MCL. i don't in which way he will send all data to SQL server Database, so what i need to do is to monitor new data inserting.
2) how to auto generate and print report directly after record been inserted into the table ? Do i need to import report web service API ? if yes, which one? or i can use other methods e.g. predefine report control view in my window application, turn off pop-up menu while printing a report(I guess)
thanks
View 2 Replies
View Related
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
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
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
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
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
View Related
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Apr 24, 2008
Hi all,
I used to use <asp:SqlDataSource as a data suorce to my gridviews in the client side, but now I'm using access database.
Is there any way to use the same feauter with Ole Database connection, this is a sample from my <asp:SqlDataSource:
<asp:GridView ID="OrderGridView" runat="server" AutoGenerateColumns="False" DataSourceID="OrderSqlDataSource">
<asp:SqlDataSource ID="OrderPrintSqlDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:iainternetConnectionString %>" SelectCommand="SELECT * FROM @tblOrder"> <SelectParameters> <asp:QueryStringParameter Name="tblOrder" QueryStringField="tbl" /> </SelectParameters> </asp:SqlDataSource>
any ideas to solve this. thanks.
View 5 Replies
View Related
Apr 25, 2007
Hello,
Is it possible to access both my database and the ASPNETDB within the same SQLDATASOURCE using SQL Express ?
I want to pull out some user details from the aspnet_* tables within the ASPNETDB
In my database I have created the 'UserId' fields so the relevant joins can take place.
In my web.config:
<connectionStrings>
<add name="mydb" connectionString="Data Source=.SQLEXPRESS;AttachDbFilename=|DataDirectory|mydb.mdf;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient" />
</connectionStrings>
In my asp (showing only mydb):
<asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:mydb %>"
SelectCommand="SELECT [CreateDtTime], [UserId], [Comment] FROM [Log_Dtl] WHERE ([LogId] = @LogId)">
<SelectParameters>
<asp:QueryStringParameter Name="LogId" QueryStringField="LogId" Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>
Any help would be appreciated.
Thank you
Lee
View 1 Replies
View Related
Sep 13, 2006
HiI have a table in my database called 'tblUsers'It contains usernames and a few columns of data.One of them in 'birthday'it is in the format dd/mm (ie 28/04 is 28th of april)it is always 5 characters longIts data type is char in my db.Now I try this<asp:SqlDataSource ID="SqlDataSource8" runat="server" ConnectionString="<%$ ConnectionStrings:IntranetConnectionString %>" SelectCommand="SELECT DisplayName FROM [tblUsers] WHERE ([Birthday] = @ShortDate)"> <SelectParameters> <asp:ControlParameter ControlID="Calendar1" Name="ShortDate" PropertyName="SelectedDate" Type="string" /> </SelectParameters> </asp:SqlDataSource>where the selected date from a calendar control is used.Now it works when the table has a Date column which is off type DateTime but how would I modify it to work like I want?Thanks!
View 3 Replies
View Related