Help Me In Writing The Code In Database

Jun 6, 2008

Hi Friends, 
Please any one help me in writing the code in this
I have 3 fileds
1)empId-->textbox
2)Roles-->4 radiobuttons(MN,PL,TL,CL)
3)Responsibilities--->3 check boxes(profile,register,change password)
I have 3 tables
table1:

RoleMasterTable:

roleID        roleName
1              MN
2               PL
3               TL
4              CL

table2:
ResponsibilityMasterTable

resId      resName
1           profile
2          register
3          changepassword

tables3

MasterTable:
empId          roleId     resId




the form conatains the empId,Roles(radiobuttons),Responsibilies(chechboxes)
for example  I have to enter empId=1
select one radiobutton that is "PL"
and I can select check boxes profile,register and many
after submitting the button("submit) these details has to store in the database table i.e master table
I have to show the final o/p like this in the table

MasterTable
empId     roleId    resId
1              2           1,2

Please any one help in this I am beginner in database c# programming
Please its very helpful to me............

Thanks & Regards
Geeta
           


    

View 7 Replies


ADVERTISEMENT

Writing A Custom Code Example

Oct 19, 2007


I have been stuck in a problem for a while now. I am trying to count the number of groups. I tried soo many things and nothing worked . Now I want to try to write a function that does the counting for me.

Can somebody write me an example of a cutom code that can be called from expression.
So my custome code should be something like that

Public int CountFun(int counter)
{
Return counter= counter +1;

}

Also how do I call this method from my expression?
i am going to call it from a field inside the groups, so each time the group is implemented i add one to the counter.

thanks

View 4 Replies View Related

Writing Binary Data To A SQL Table (VB CODE)

Mar 9, 2006

First of all let me say that ASP.NET a new programming environment for me so please forgive my ignorance.
Can someone please tell me how to write data to a SQL table that is a Binary data type?  I have a stored procedure on the SQL server that I am calling to insert data into a table.  I build a parameter list and set the values.  It worked just fine before I added a binary field to the SQL table.  My problem is that I don't know how to set the Binay data type to pass it to the stored procedure.  Here is part of the code:
GetCMD = Myconnection.CreateCommand
GetCMD.CommandType = CommandType.StoredProcedure
GetCMD.CommandText = "SCHEMANAME.InsertLineItem"
GetCMD.Parameters.Add("HEADER_ID", SqlDbType.VarChar, 150)
GetCMD.Parameters("HEADER_ID").Value = "some value"
GetCMD.Parameters.Add("@OPTIONS", SqlDbType.Binary)
GetCMD.Parameters("@OPTIONS").Value =  HOW DO I SET THIS VALUE????
rowsaffected = GetCMD.ExecuteNonQuery()
I assume serialization but have not figured out how.  Anyone's help is greatly appreciated!!

View 1 Replies View Related

Writing Code Vs Using Stored Procedure Within SSIS

Aug 7, 2007



Was wondering which is better, writing the SQL code within the execute SQL task or calling a SP from within it with respect to performance? and what is the best practice? Also is there any way to incoporate the logic of a cursur within SSIS?

Thanks

View 3 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

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 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

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

Right Code Statements Of SqlConnection &&amp; ConnectionString For Connecting A Database In Database Explorer Of VB 2005 Express?

Feb 14, 2008

Hi all,

In the VB 2005 Express, I can get the SqlConnection and ConnectionString of a Database "shcDB" in the Object Explorer of SQL Server Management Studio Express (SSMSE) by the following set of code:
///--CallshcSpAdoNetVB2005.vb--////

Imports System.Data

Imports System.Data.SqlClient

Imports System.Data.SqlTypes

Public Class Form1

Public Sub InsertNewFriend()

Dim connectionString As String = "Data Source=.SQLEXPRESS;Initial Catalog=shcDB;Integrated Security=SSPI;"

Dim connection As SqlConnection = New SqlConnection(connectionString)

Try

connection.Open()

Dim command As SqlCommand = New SqlCommand("sp_insertNewRecord", connection)

command.CommandType = CommandType.StoredProcedure
.......................................
etc.
///////////////////////////////////////////////////////
If the Database "shcDB" and the Stored Procedure "sp_inertNewRecord" are in the Database Explorer of VB 2005 Express, I plan to use "Data Source=local" in the following code statements to get the SqlConnection and ConnectionString:
.........................
........................

Dim connectionString As String = "Data Source=local;Initial Catalog=shcDB;Integrated Security=SSPI;"

Dim connection As SqlConnection = New SqlConnection(connectionString)

Try

connection.Open()

Dim command As SqlCommand = New SqlCommand("sp_insertNewRecord", connection)

command.CommandType = CommandType.StoredProcedure
........................
etc.

Is the "Data Source=local" statement right for this case? If not, what is the right code statement for my case?

Please help and advise.

Thanks,
Scott Chang

View 6 Replies View Related

Create Database From Code

Sep 13, 2006

Hi, I want to create a database setup on a server. I've scripted my database from sql server express. I've tested the code in the query window and it worked. When i pasted the same code in a sqlcommand command text....the debuger threw an sql exception....saying the sintax is wrong near keywords GO, USE, some forgein keys, and so on. Here is a chunk of the script.USE [master]GO/****** Object:  Database [estate_management]    Script Date: 09/13/2006 09:19:32 ******/CREATE DATABASE [estate_management] ON  PRIMARY ( NAME = N'estate_management', FILENAME = N'D:MSSQLestate_management.mdf' , SIZE = 2048KB , MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB ) LOG ON ( NAME = N'estate_management_log', FILENAME = N'D:MSSQLestate_management_log.ldf' , SIZE = 1024KB , MAXSIZE = 2048GB , FILEGROWTH = 10%) COLLATE SQL_Latin1_General_CP1_CI_ASSET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGOIF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[admin]') AND type in (N'U'))BEGINCREATE TABLE [dbo].[admin](    [admin_id] [int] IDENTITY(1,1) NOT NULL,    [log_in_id] [varchar](20) NOT NULL,    [password] [varchar](50) NOT NULL, CONSTRAINT [PK__admin__07020F21] PRIMARY KEY CLUSTERED (    [admin_id] ASC)WITH (PAD_INDEX  = OFF, IGNORE_DUP_KEY = OFF, FILLFACTOR = 1) ON [PRIMARY], CONSTRAINT [IX_admin] UNIQUE NONCLUSTERED (    [admin_id] ASC)WITH (PAD_INDEX  = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]) ON [PRIMARY]END Thanks for your time. 

View 1 Replies View Related

Query By Database Or Code

Nov 8, 2007

I have a database and would like to retrieve specific data via queries. This database is also connected to an ASP .Net 2.0 application to be the front end. Ive created the query in the database. Would you recommend i use parameter names to retrieve the data via code or should i have the query within my code to retrieve the data?
Thanks

View 6 Replies View Related

Retrieving A Value From A SQL Database In Code Behind

Nov 29, 2007

VWD 2005 Express.  I need to retrieve a value from a SQL database from the code behind a page and assign it to a variable.  In Microsoft Access I can do this using the DLookup function.  What I need to do is get the data that results from the following query into a variable:
SELECT [SystemUserId] FROM [SystemUser] WHERE ([Username] = @Username)
The name of the data source is SqlDataSource2
Also, in Access I can create a recordset from a query and then process through the recordset.  Can that be done in VB code in VWD 2005 Express?

View 16 Replies View Related

Database Code Structure

Apr 26, 2008

What method would you suggest is the best way to deal with a website?

Say for example, writing SQL. Am I better using Stored Procedures and adding methods for accessing there or just writing the SQL inline. What do you think about this? Is it totally overkill to use stored procedures in a small website?  

View 6 Replies View Related

DTS To Execute Vb Code Within A Database?

Dec 30, 2005

i have a piece of code in an adp that is currently behind a form but i could put it in a module and make it public if i need to. how can I use DTS to run this piece of code? which connection and task could i use. can this even be done? i have little experiance with DTS.

thanks.

justin

View 1 Replies View Related







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