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


ADVERTISEMENT

BCP Not Writing To Error Log

Nov 29, 2007



Hi,

I'm trying to capture errors when executing my BCP to stop my batch job from continuing on to the the next steps.

Here's the syntax of my bcp

bcp TestDB.dbo.bcp_load in "C: estfile.csv" -S testserver -e "C:Logserror.log" -T -t , -c

I deliberately altered my file to force an error. The error that I'm trying to trap is

SQLState = HY000, NativeError = 0
Error = [Microsoft][SQL Native Client]Unexpected EOF encountered in BCP data-file
0 rows copied.
Network packet size (bytes): 4096
Clock Time (ms.) Total : 1

Instead of writing the error to C:Logserror.log, it is being generated in my dos prompt.

I cannot use attribute -o as it will write everything in the log including non-errors. What am I missing in my bcp and why is it not writing to my errorlog? HELP!

Thanks

View 3 Replies View Related

Error 3105 While Writing

Jun 6, 2001

When I am writing a numerous number of records to an sql 2000 db from a single "large" *.dbf I eventually get an error, error code 3105 from the ole
db provider for sql (Error Description: The requested properties cannot be supported), after about 400 or so records are written. I monitored
what commands the sql server is doing and this is where is gives me an error:

(previous command from sql monitor for reference)
declare @P1 int
set @P1=180150371 <-------- p1 gets incremented by one every consecutive time I write something to the db
declare @P2 int
set @P2=2 <-------------- same as all previous writes
declare @P3 int
set @P3=4 <-------------- same as all previous writes
declare @P4 int
set @P4=-1 <-------------- same as all previous writes
exec sp_cursoropen @P1 output, N'SELECT UUT_NUM,SEQ_RESULT, (etc...), @P2 output, @P3 output,
@P4 output
select @P1, @P2, @P3, @P4

(this is where the error is)
declare @P1 int
set @P1=0
declare @P2 int
set @P2=229378
declare @P3 int
set @P3=294916
declare @P4 int
set @P4=0
exec sp_cursoropen @P1 output, N'SELECT UUT_NUM,SEQ_RESULT,(etc...),@P2 output, @P3 output, @P4 output
select @P1, @P2, @P3, @P4

It appears as though the P1 counter is reset to 0 for some reason and the other variables are not assigned the same value as all previous
times the write command was executed.
Does anyone know why this occurs? and why this gives me an error?

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

Writing Error To The Windows Event Log

Feb 13, 2007

Hi,

I am developing a package that will be run by a master package. The main task of this package is to write the errorid, errordescription and other details passed by the master package to various destination like a text file, a sql server or an event log.

I am using the flat file and the OLEDB destination for the text file and sql server. But I could not find any destination component that will help to write to an event log. Do I have to write a destination custom component for this?

I will then use this package in the event handler at the package level. Also comment on my approach.

Thanks in advance for your help and time.

Regards,

$wapnil

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

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

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

Error In Writing Condition In Complex Query

Apr 4, 2015

following is a working code

declare @dte as datetime='2015-04-01'
declare @StDt as Datetime = DATEADD(mm,DATEDIFF(mm,0,@dte), 0)
declare @EnDt as datetime = DATEADD( DD, -1, DATEADD(mm,DATEDIFF(mm,0,@dte) + 1, 0));
DECLARE @query AS NVARCHAR(MAX);

[code]...

iam getting the ouput correctly my requirement is i want to write a condition here
JOIN busdetails b ON m.bus_id = b.bus_id
i want to write this statement as
JOIN busdetails b ON m.bus_id = b.bus_id and m.uname='lekshmi'

when i tried this code iam getting error

View 1 Replies View Related

Error Writing To UserVariable In ScriptComponent In DataFlow

Oct 23, 2007



I have an SSIS Packaget that worked a month ago and when I ran it today it didn't work. It's failing in the ScriptComponent in a DataFlow that I created as a Destination. The only thing the script does is record any value for a particular column and on the PostExecute method, writes the last instance of that column to a user variable in the Package. Here's the code. There is a string variable that I use to hold the column's value for each row received.



Public Class ScriptMain

Inherits UserComponent


Dim s_remit_addr As String


Public Overrides Sub Input0_ProcessInputRow(ByVal Row As Input0Buffer)


Me.s_remit_addr = Row.remitaddr.ToString()

End Sub


Public Overrides Sub PostExecute()


Dim variables As Variables


Variables.gsremitaddr = Me.s_remit_addr

MyBase.PostExecute()

End Sub



It will always bomb in PostExecute with the error that the variable User::gs_remit_addr is not the same type as the variable I'm using (s_remit_addr); HOWEVER, the user variable is of type String and it worked a month ago. Does anyone have any idea how I can fix it?

View 3 Replies View Related

Writing ETL Error Records To A Common Table

Jun 13, 2007

I am working on building a template/design pattern for a DTS to SSIS upgrade project.



During our ETL processing, if we encounter a record that cannot be inserted into a destination table, we'd like to be able to write the entire record out to a common error/reject table. The obvious problem is that every SSIS package that is using this template will of course be dealing with varying table schemas.



I was thinking that if there were a way that I could transform the error record/buffer row into XML, I could then achieve my goal of having a common table to receive errors/rejects.



Has anyone done something like this, or have suggestions on how we might accomplish?



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

Remote Connection Error : Problem In Writing In A Table

Feb 15, 2008

Hi,
I have a problem when updating tables in a SQL Server 2000. I am able to make a select form tables but I can't insert data. I got this error :
An error has occurred while establishing a connection to the server.  When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
SQLExpress database file auto-creation error:

View 3 Replies View Related

Error When Writing To SQL Server Through Asp Page Using Windows Authentication

Jul 20, 2005

I have an asp drive web page that writes a row to a table on sqlserver 2000. The web site is set to use windows authenication and thesql server is set to use windows authentication.This process works fine on windows xp sp 1 machines but on win2k sp4machines logged in as the same user i get the errorAn error occurred making the change -2147217843 Error connection toSQL Server: [Microsoft][ODBC SQL Server Driver][SQL Server]Loginfailed for user '(null)'. Reason: Not associated with a trusted SQLServer connection.can anyone explain why win2k client would have this issue and notwinxp clients?Glenn

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

Fatal Network Error 4014 When Writing Big BLOB Chunks

Jun 1, 2007

Using the SqlClient provider I'm trying to write big datachunks of maybe 20 MB each to SQL server to store in BLOBs using blobColumn.Write(...) using .NET 2.0 dbcommand object calling a Stored procedure



CREATE PROCEDURE [dbo].[putBlobByPK]

(

@id dKey

, @value VARBINARY(MAX)

, @offset bigint

, @length bigint

, @ModDttm dModDttm OUT

, @ModUser dModUser OUT

, @ModClient dModClient OUT

, @ModAppl dModAppl OUT

)

....



When doing this I can do this exactly 3 times than the application hangs (for ever).



When looking in the SQL Server log, I find the following to errors:



Error: 4014, Severity: 20, Status: 2.



A fatal error occurred while reading the input stream from the network. The session will be terminated.



I don't get this error on the client! OK, the session died.



What may be the problem?



I write big chunks like this to avoid many writes as the data shall be replicated later using peer to peer replication. And the more writes used for writing the total BLOB the more huge becomes the transaction log of the subscriber database.



TIA



Hannoman

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