SqlDataSourceStatusEventArgs.AffectedRows Property

Nov 16, 2007

 I'm confused about the e.AffectedRows documentation.  The documentation says that e.AffectedRows is, "The number of rows affected by a database operation. The default value is -1."
I am getting -1 returned after a successful update. 
Am I supposed to get -1 returned after a successful operation or a 1 because 1 row was affected by the update? 

View 2 Replies


ADVERTISEMENT

One Row Returned But E.AffectedRows ==0?

Jan 9, 2007

Stored Procedure:CREATE PROCEDURE [dbo].[GetBanner]     @BannerPage nvarchar(50),    @MagazineID intASBEGIN    SET NOCOUNT ON;    DECLARE @BannerID int     SELECT TOP 1    @BannerID = BannerID    FROM Banners    WHERE BannerPage=@BannerPage AND MagazineID = @MagazineID    AND StartDate <= GetDate() AND EndDate >=GetDate()    ORDER BY Views    SELECT     BannerID,     BannerFileName,     AltText,     URL,     Views     FROM Banners     WHERE BannerID = @BannerID           UPDATE Banners SET Views = Views +1 WHERE BannerID = @BannerID     UPDATE BannerStats SET Views = Views + 1 WHERE BannerID = @BannerIDEND OnSelected method: protected void dsBanner_Selected(object sender, SqlDataSourceStatusEventArgs e)    {        int RecordCount = e.AffectedRows;            Response.Write(RecordCount);    }  This ALWAYS gives me 0 - despite the fact that the correct banner is pulled from the database, and updated etc.  Also, when I execute the procedure (for valid parameter values) in SSMS, I get "1 row(s) Affected".  Can anyone tell me what I need to change to get the proper value? Thanks   

View 6 Replies View Related

AffectedRows Different From ObjectDataSource Then SqlDataSource

May 27, 2008

I have a gridview control that accesses either an objectdatasource or a sqldatasource
both of which excute "select * from customers"
 the affected-rows property when using the sqldatasource is always the number of rows returned (what I want)
but i need to use an object data source to access a table-adapter
when using the ODS affectedrows is always -1 no matter how mayn rows were returned
 why is this
 is there another way to get the number of records returned by an ODS

View 1 Replies View Related

Custom Events While Retaining Original Event Arguments (SqlDataSourceStatusEventArgs)

Dec 26, 2007

Hi,
I am looking to implement a custom event handler that will also retain the original event arguments (in addition to several custom arguments).
Specifically, I am looking to pass custom arguments into a SqlDataSourceStatusEventHandler, but also want to be able to access the Command.Parameters.
I have implemented a new Event Arguments class (derived from System.EventArgs), new Event class and delegate, but do not know how to retain the SqlDataSourceEventArgs. I would really appreciate your suggestions!
Thanks!
 

View 2 Replies View Related

Changing Code Page Property Using Property Expression Doesn't Work

Jun 16, 2006

I am having problems exporting data into a flat file using specific code page. My application has a variable "User::CodePage" that stores code page value (936, 950, 1252, etc) based on the data source. This variable is assigned to the CodePage property of desitnation file connection using Property expression.

But, when I execute the package, the CodePage property of the Destination file connection defaults to the initial value that was set for "User:CodePage" variable in design mode. I checked the value within the variable during runtime and it changes correctly for each data source. But, the property of the destinatin file connection doesn't change and results in an error.

[Flat File Destination [473]] Error: Data conversion failed. The data conversion for column "Column01" returned status value 4 and status text "Text was truncated or one or more characters had no match in the target code page.".

[DTS.Pipeline] Error: The ProcessInput method on component "Flat File Destination" (473) failed with error code 0xC02020A0. The identified component returned an error from the ProcessInput method. The error is specific to the component, but the error is fatal and will cause the Data Flow task to stop running.

If I manually update the variable with correct code page and re-run the ETL, everything works fine. Just that it doesn't work during run-time mode.

Can someone please help me resolve this.

Thanks much.

View 5 Replies View Related

Value Of A Readonly Property Of Custom Task Is Not Updated In Property Window

Apr 17, 2008

Hi,

I developed a simple custom control flow component which has several read/write properties and one readonly property (lets call it ROP) whichs Get method simple returns the value of a private variable (VAR as string). In the Execute method the VAR has a value assigened. When I put the value of ROP or VAR into MsgBox I can see the correct value. However when I execute the component I can not see the value of the ROP in the property window. I see the property but its value is empty string. For example when I put a breakpoint to postexecute or check the property before click OK in a MsgBox I would expect that the property value would be updated in SSIS as well. Is there a way how to display correct values of custom tasks properties in property window?

Thanks for any hints.

View 3 Replies View Related

(URGENT) Cannot Be Written To The Property. The Expression Was Evaluated, But Cannot Be Set On The Property

May 7, 2008

Untill recently I had a smooth running SSIS package,but suddenly it throws error syaing
"OnError,,,,,,,The result of the expression

"@[User:trTextFileImpDirectory] +"SomeTextStringHere"+ @[User:trANTTextFileName] +(DT_STR,30,1252) @[User:taging_Date_Key]+ "SomeTextStringHere"
" on property "ConnectionString" cannot be written to the property. The expression was evaluated, but cannot be set on the property."

I have child SSIS package running under a parent package (through execute package task)

I have few flat file connection managers in child package for text file import , in which I am building text file path dynamically at run time by assigning an expression in connection string property of connection manager.
The Expression is as follows



"@[User:trTextFileImpDirectory] +"SomeTextStringHere."+ @[User:trANTTextFileName] +(DT_STR,30,1252) @[User:taging_Date_Key]+ +"SomeTextStringHere"

Where @[User:trTextFileImpDirectory] is a variable which contains path of directory containg text
files.Value in this variable is assigned at runtime from parent package's variable,which in turns fetch
value from a configuration file on local server.

With my current configuration this path has been configured to some other server's directory over network ( I.e my package picks text files from some other servers folder over network)

While
"Some string here"+ @[User:trANTTextFileName]" part of file name string.

(DT_STR,30,1252) @[User:taging_Date_Key] Contain the date of processing ,value in this variable is also picked up at run time from parent package variable.

1) So can someone give me some insight into possible reason of failures.
2) Is it possible that problem arises if directory (from which I m picking text files) is assigned password or is there exist some problem in accessing forlders over network ?
3) Or there can be some problem in package configuration at design time( I.e where I m assigning value in variable from parent package vriables)?




View 10 Replies View Related

Referencing One Item's Hidden Property In Order To Set Another's Hidden Property

Feb 15, 2007

Hello,

I have a group I'll call G4.

The header table row for G4 contains 3 textboxes containing the sums of the contents within G4. The header table row for G4 is visible while it's contents, including the G4 footer table row, is kept invisible until the report user drills down into the group.

When the report user drills down into G4 the footer table row becomes visible and the sums of the contents of the group are displayed for a second time.

At this point I want the sums in the header to be set to invisible when the sums in the footer are made visible by the drilldown.

When I try to reference the hidden property of textbox66 in the G4 footer in order to set the hidden property of header textbox57 in the G4 header I get to this point...

=IIF(reportitems!textbox66.

When it fails to give me an option of choosing the .Hidden property and instead only gives me a .Value.

If I complete the IIF statement manually so that it spells out .....

=IIF(ReportItems!Textbox66.Hidden = False, True, False)

...the report chokes on it.

So my question is, how do I reference the hidden property of one or more textboxes in a group to use as condition checks to set the hidden property of another textbox in that same group?

Thank you for any help you can provide. We are only now beginning to implement reporting services and I have not yet had the chance to research this in greater detail for lack of time.



View 1 Replies View Related

ConnectionString Property

Jun 28, 2006

I am having trouble initializing my connection. This is the code:


Dim
DBConnPhone As New
SqlConnection(ConfigurationManager.AppSettings("DBConnPhone"))




        Dim DBConnClient As New
SqlConnection(ConfigurationManager.AppSettings("DBConnClient"))       


        Dim Sqlcomm1 As New SqlCommand


        Dim Sqlcomm2 As New SqlCommand


        DBConnPhone.Open()


       
DBConnClient.Open()

Once I start debugging, it stops and give me the error "The ConnectionString Property was not initialized" Any suggestions?

View 4 Replies View Related

ConnectionString Property Not Set

Feb 14, 2007

 
Hi, After many nights without sleep I'm not seeing this? Can anyone help why I'm getting a ConnectionString Property not set error? thanks!
Dim Sconn As StringDim DBCon As New Data.SqlClient.SqlConnectionSconn = ConfigurationManager.AppSettings("LocalSqlServer")DBCon = New SqlClient.SqlConnection(Sconn)Dim cmdCommand As New Data.SqlClient.SqlCommand
'Dont forget to instantiate a connection object
cmdCommand.Connection = DBConDBCon.Open()

View 18 Replies View Related

How Can I Set Description Property By T-SQL ?

Jun 6, 2007

I would like to create table by T-SQLand need to specify DescriptionBut I can't find any sample to add Description property by T-SQL  Additionally, I also would like modify Description property by T-SQL. What can I do ?????  Please help me ...... 

View 2 Replies View Related

Identity Property

Jul 6, 2007

Hello friends,
I am using sql server 2005. In some tables to create the column Autoincrement I had set the 'Idetity Specification' property to 'Yes'. I want to know that how can we do it through sql scripts i.e. by writing query.
Please let me know
Thanks & RegardsGirish Nehte

View 6 Replies View Related

Property Owners

May 7, 2008

I'm trying to see the properties of a database and I'm getting the following error, even when trying to connect as sa.

Property Owner is not available for Database '[EPro]'. This property may not exist for this object, or may not be retrievable due to insufficient access rights.

any ideas? thanks in advance

View 1 Replies View Related

Server Property

May 24, 2008

hi,
whether there is any server property to remove lines while viewing the records in text mode

sample data:

select * from Employee
sno ename
--- ------
1 aaa
2 nnn

i need to remove the below the sno and ename column

View 11 Replies View Related

LineHeight Property

Jun 12, 2006

I am use Reporting services 2000 SP2 and discover that the LineHeight property rendered correctly only in renderers for HTML output. PDF renderer, TIFF renderer and client side printing client do not render changes in this property at all.

Is it bug in Reporting services 2000?

Can someone try to change LineHeight property in SQL Server 2005 Reporting services and verify rendering output?

View 3 Replies View Related

Where Is The IsSorted Property?

Nov 9, 2006

Hello. 

within a data flow task I have two OLE DB sources that I am attempting to put into a merge join.

When I connect them to the merge join transformation I get the following error:

The IsSorted property must be set to true on both sources of this transformation.

I understand what this means but I cannot see an IsSorted option in the properties of the OLE DB sources so I can't set it. Can you tell me where it is? for the time being I'm having to put a sort transform in to get it to work.

Thanks

 

 

View 13 Replies View Related

Regarding Extended Property

Oct 31, 2006

hi,

Can anyone tell me how to use the extended stored property like sp_addextendedproperty in java code?

Thanks,

Meghna

View 2 Replies View Related

Every Time Job Property Changes

Mar 30, 2007

Dear friends,

Every time i open the jobs propertimes on server, it changes the sql server login to windows from sql authentication. also the properties i set at the time of creating a job had given me an option to select the run as user but from that moment the option has gone, whats that all about?

thanks,

View 5 Replies View Related

No CSS Property For Textbox?

Jan 3, 2007

We want to use our styles say "mystyle" on a report. I am surprised that we do not have cssstylename as a property for a textbox?

Ideally, i should be able to add that style in the styles.css file and reference the style name on the textbox. All that would be needed is that it would add an attribute to the rendered html. I wonder if it already exists and i am missing some information?

View 3 Replies View Related

What Is It InteractiveMode Property Really For?

Sep 28, 2006

hi everyone,

According the information provided by BIDS if it have false anulates any message such as msgbox or something like that from the ssis execution. is it true?

TIA

View 1 Replies View Related

Repeatwith Property

Sep 14, 2007

I'm trying to figure out this repeatwith property setting. I have a row of textboxes that are labels at the top of the body of my report. Under this row is a list box "LstCategory" with a sublist "SubLstCategory". I set the repeatwith to LstCategory.
When I preview the report in VS it doesn't. When I publish this report in Report Manager it does. When I export from Report Manager (In PDF Format) it doesn't.

What do I have to do so it will repeat in Reporting Services?
Is it normal that In Report Manager that what you view does not export the same way?

I'm new at this altogether. About 4 months in SQL and 1 month with Reporting Services. So be gentle.

Regards,
Card Gunner

View 4 Replies View Related

The ConnectionString Property Has Not Been Initialized

Jul 30, 2007

In short, I have a couple grid views on a page that are used for editing as well as sorting, etc.  The grids are setup to use the SqlDataSources.  I'm trying to deploy this to a server environment for different instances (test,cert,prod) and am trying to set the ConnectionString for the SqlDataSource in the code behind (Page_Load()).  Everything works well, except, I get an error message that says the "ConnectionString Property Has Not Been Initialized."  Its a javascript alert coming up on top of the grid view.
Here is how I'm trying to set the ConnString in the Page_Load():this.EmployeeTimeCardDataSource.ConnectionString = ConfigurationManager.ConnectionStrings[connStr].ConnectionString;
Here is an example of the DataSource.<asp:SqlDataSource ID="EmployeeTimeCardDataSource" runat="server"    SelectCommand="sp_Select_Managers_Employees_List"    SelectCommandType="StoredProcedure">  <SelectParameters>     <asp:SessionParameter Name="CurrentUser" SessionField="User" Type="String" />  </SelectParameters></asp:SqlDataSource>
 

View 5 Replies View Related

The 'DataSource' Property Cannot Be Set Declaratively

Aug 24, 2007

This my code for a blog page that shows active blogs:
<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" Title="Blogs"%><asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<h3>My blogs</h3>
<asp:GridView ID="Gridview1" runat="server" AllowPaging="true" AutoGenerateColumns="false" DataSource="SqlDataSource1">
<Columns>
<asp:TemplateField>
<HeaderTemplate>
Blog
</HeaderTemplate>
<ItemTemplate>
<b><asp:LinkButton ID="LinkButton1" runat="server" Text='<%#Bind("name") %>'
PostBackUrl='<%#Bind("blogid" "Blog.aspx?Blog={0}" %>' />
 
<br/>
<asp:Label ID="label2" runat="server" Text='<%#Bind ("description") %>' />
 
</ItemTemplate>
<HeaderStyle HorizontalAlign="Left" />
<ItemStyle Width="250px"/>
</asp:TemplateField>
<asp:BoundField DataField="username" HeaderText="Owner">
<HeaderStyle HorizontalAlign="Left" Width="100px" />
<ItemStyle HorizontalAlign="Left" Width="100px" />
</asp:BoundField>
<asp:BoundField DataField="posts" HeaderText="posts">
<HeaderStyle HorizontalAlign="Left" />
<ItemStyle HorizontalAlign="Left" Width="80px" />
</asp:BoundField>
 </Columns>
</asp:GridView><asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ConnectionStrings:BlogConnectionStrings%>"
SelectCommand="SELECT [blogid], [name], [description], [username], [posts] from [Blogs] ORDER By[name]">
</asp:SqlDataSource> </asp:Content>
Compiling that i get the error in the subject specifically for line 4 (in bold). Any ideas?

View 3 Replies View Related

Save Dr Property To Variable

Oct 10, 2007

 how do you store a datareader propety to a variable? Below is my current code. I have already declared my connectionString and sqlComm objects, as well as the userName and such. I need to store the value from the dr to the variables, UserName, UserPass, and serverName. ThanksTry
sqlCon.Open()
dr = sqlComm.ExecuteReader
While dr.Read
userName = dr("uName").ToString
LogInfo("userName = " & userName)

userPass = dr("uPass").ToString
LogInfo("userPass = " & userPass)

serverName = dr("sName").ToString
LogInfo("serverName = " & serverName)
End While
dr.Close()
Catch obug As Exception
LogEvent("Credentials Error: " & obug.Message)
Finally
sqlCon.Close()
End Try
 

View 3 Replies View Related

ConnectionString Property Not Initialized

Oct 22, 2007

I am getting an error message that says that my connection string has not been intialized I have initialized it. 
Dim AirliquidiConn As New SqlClient.SqlConnection(ConfigurationManager.AppSettings("AirliquidiDatabase"))
Any suggestions??

View 10 Replies View Related

The ConnectionString Property Has Not Been Initialized

Jan 25, 2008

Hi all
      This is the code in my web.config file.
       <appSettings>    <add key="ConnectionString" value="server=127.0.0.1;database=testdb;uid=sa;pwd=sa"/>     </appSettings>
      When I'm connecting to the sqlserver database,the page shows that The ConnectionString property has not been initialized.
      The code that I used to get the "ConnectionString" as belows
using System.Configuration;
protected static string connectionString =ConfigurationSettings.AppSettings["ConnectionString"]; 
  public static object GetSingle(string SQLString,params SqlParameter[] cmdParms)  {   using (SqlConnection connection = new SqlConnection(connectionString))   {    using (SqlCommand cmd = new SqlCommand())    {     try     {                              PrepareCommand(cmd, connection, null,SQLString, cmdParms);      object obj = cmd.ExecuteScalar();      cmd.Parameters.Clear();      if((Object.Equals(obj,null))||(Object.Equals(obj,System.DBNull.Value)))      {            return null;      }      else      {       return obj;      }         }     catch(System.Data.SqlClient.SqlException e)     {          throw new Exception(e.Message);     }         }   }  }
 
These code works well on my machine.When running on my colleague's machine ,the page show that exception.
  Any ideal?

View 3 Replies View Related

Conflict Detection Property

Feb 17, 2008

hi;
What is conflict detection in sqldatasource control?
Thanks,mohsen

View 1 Replies View Related

The ConnectionString Property Has Not Been Initialized.

Mar 21, 2008

I tried to insert my inputs into the database but it says "The ConnectionString property has not been initialized."
 
These are my codes:
SubmitAssigment.aspx.vb
 Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click Dim conn As SqlConnection Dim mycmd As SqlCommand Dim dr As SqlDataReader Dim str As String conn = New SqlConnection(Configuration.ConfigurationManager.AppSettings("ConnectionString")) conn.Open() str = "INSERT INTO [UploadInfo] ([StudentID], [Subject], [Assigment], [File], [Upload], [Time]) VALUES (@StudentID, @Subject, @Assigment, @File, @Upload , @Time )" mycmd = New SqlCommand(str, conn) mycmd.Parameters.Add("@StudentID", Data.SqlDbType.VarChar, 500).Value = User.Identity.Name mycmd.Parameters.Add("@Subject", Data.SqlDbType.VarChar, 500).Value = DropDownList1.SelectedValue mycmd.Parameters.Add("@Assigment", Data.SqlDbType.VarChar, 500).Value = DropDownList2.SelectedValue mycmd.Parameters.Add("@File", Data.SqlDbType.VarChar, 500).Value = File1.PostedFile.FileName mycmd.Parameters.Add("@Upload", Data.SqlDbType.VarChar, 500).Value = "Yes" mycmd.Parameters.Add("@Time", Data.SqlDbType.VarChar, 500).Value = System.DateTime.Now dr = mycmd.ExecuteReader() mycmd.Dispose() dr.Close() End Sub
  
SubmitAssigment.aspx
 
 <%@ Page Language="VB" AutoEventWireup="false" CodeFile="SubmitAssigment.aspx.vb" Inherits="Student_SubmitAssigment" %><!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>Untitled Page</title> <style type="text/css"> .style1 { width: 100%; } .style2 { width: 70px; } .style3 { width: 106px; } </style></head><body> <form id="Form1" method="post" enctype="multipart/form-data" runat="server"> <p> &nbsp;</p> <table class="style1"> <tr> <td class="style2"> Subject:</td> <td> <asp:DropDownList ID="DropDownList1" runat="server" Height="16px" Width="253px"> <asp:ListItem Selected="True">Select one....</asp:ListItem> <asp:ListItem>TCP2411 - Programming Language Concept</asp:ListItem> </asp:DropDownList> </td> </tr> <tr> <td class="style2"> Assigment</td> <td> <asp:DropDownList ID="DropDownList2" runat="server" Height="16px" Width="105px"> <asp:ListItem Selected="True">Select one....</asp:ListItem> <asp:ListItem>1</asp:ListItem> <asp:ListItem>2</asp:ListItem> <asp:ListItem>3</asp:ListItem> <asp:ListItem></asp:ListItem> </asp:DropDownList> </td> </tr> </table><p> &nbsp;</p> <input type= "file" id= "File1" name= "File1" runat="server" /> <br /><br />&nbsp;<asp:Button ID="Submit1" runat="server" Text="Upload" /> <br /> <br /> <br /> <asp:LoginName ID="LoginName" runat="server" /> <br /> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConflictDetection="CompareAllValues" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" DeleteCommand="DELETE FROM [UploadInfo] WHERE [StudentID] = @original_StudentID AND [Subject] = @original_Subject AND [Assigment] = @original_Assigment AND [File] = @original_File AND [Upload] = @original_Upload AND [Time] = @original_Time" InsertCommand="INSERT INTO [UploadInfo] ([StudentID], [Subject], [Assigment], [File], [Upload], [Time]) VALUES (@StudentID, @Subject, @Assigment, @File, @Upload , @Time))" OldValuesParameterFormatString="original_{0}" SelectCommand="SELECT [StudentID], [Subject], [Assigment], [File], [Upload], [Time] FROM [UploadInfo]" UpdateCommand="UPDATE [UploadInfo] SET [Subject] = @Subject, [Assigment] = @Assigment, [File] = @File, [Upload] = @Upload, [Time] = @Time WHERE [StudentID] = @original_StudentID AND [Subject] = @original_Subject AND [Assigment] = @original_Assigment AND [File] = @original_File AND [Upload] = @original_Upload AND [Time] = @original_Time"> <DeleteParameters> <asp:Parameter Name="original_StudentID" Type="String" /> <asp:Parameter Name="original_Subject" Type="String" /> <asp:Parameter Name="original_Assigment" Type="String" /> <asp:Parameter Name="original_File" Type="Object" /> <asp:Parameter Name="original_Upload" Type="String" /> <asp:Parameter Name="original_Time" Type="DateTime" /> </DeleteParameters> <UpdateParameters> <asp:Parameter Name="Subject" Type="String" /> <asp:Parameter Name="Assigment" Type="String" /> <asp:Parameter Name="File" Type="Object" /> <asp:Parameter Name="Upload" Type="String" /> <asp:Parameter Name="Time" Type="DateTime" /> <asp:Parameter Name="original_StudentID" Type="String" /> <asp:Parameter Name="original_Subject" Type="String" /> <asp:Parameter Name="original_Assigment" Type="String" /> <asp:Parameter Name="original_File" Type="Object" /> <asp:Parameter Name="original_Upload" Type="String" /> <asp:Parameter Name="original_Time" Type="DateTime" /> </UpdateParameters> <InsertParameters> <asp:Parameter Name ="StudentID" Type="String" /> <asp:Parameter Name ="Subject" Type="String" /> <asp:Parameter Name ="Assigment" Type="String" /> <asp:Parameter Name ="File" Type="Object" /> <asp:Parameter Name ="Upload" Type="String" /> <asp:Parameter Name ="Time" Type="DateTime" /> </InsertParameters> </asp:SqlDataSource> <table class="style1"> <tr> <td class="style3"> <asp:Button ID="Button1" runat="server" Text="Confirm" Width="68px" style="height: 26px" /> </td> <td> &nbsp;</td> </tr> <tr> <td class="style3"> &nbsp;</td> <td> &nbsp;</td> </tr> </table> <br /></form> </body></html> 
Can anyone help me out?
Pleasee
Thannkss... 
 

View 2 Replies View Related

Sql Server Datetime Property

Mar 31, 2008

Hello everyone,
      In my project, I have came across a field in which, I have to insert only time in my sql server 2005 version database through ASP.NET using C#. I dont want the date to be entered/displayed. I also would like to know, how I can be able to get time from the user(which control you would suggest me to use for getting time) and store it in sql server. I have to count the no. of hrs and minutes in my project, so need this help from anyone who can suggest me.  Thank you.
warm regards,
 Yakhub.

View 3 Replies View Related

What Property Should I Assign To My Sqlcommand ?

Apr 2, 2008

what property should i assign to myPuzzleCmd2 ? 
 
myConnection.Open()
 Dim myPuzzleCmd2 As New SqlCommand("GetRandomCode", myConnection)
 
myPuzzleCmd2.CommandType = CommandType.StoredProcedure
 Dim retLengthParam As New SqlParameter("@Length", SqlDbType.TinyInt, 6)
retLengthParam.Direction = ParameterDirection.Input
 
myPuzzleCmd2.Parameters.Add(retLengthParam)
 Dim retRandomCode As New SqlParameter("@RandomCode", SqlDbType.VarChar, 30)
 
retRandomCode.Direction = ParameterDirection.Output
 
myPuzzleCmd2.Parameters.Add(retRandomCode)
 
Try
 Dim reader As SqlDataReader = myPuzzleCmd2.ExecuteReader()
myPuzzleCmd.ExecuteNonQuery()Catch ex As Exception
 
myPuzzleCmd2 = Nothing
 Session.Remove("RandomCode")
 HttpContext.Current.Session("RandomCode") = myPuzzleCmd2("@RandomCode")        <  ---------       Over here
 Finally
myConnection.Close()
End Try

View 7 Replies View Related

Practical Use Of ACID Property

Apr 2, 2008

Can anyone tell me the practical use of ACID properties. I know theory available in books. But where it will implement practically I am confused.

View 8 Replies View Related

Is There Any Property Like Rownum In Oracle

Jul 30, 2004

Hi All....

I have to write one query where i have to display the ID as 1,2 3, 4 in oracle we used to ROWNUM to display ....in MS SQL server is there any property to show???

i have to display like

ID ProgramCount
1 4
2 6
3 5
4 1
5 2

Ashutosh

View 1 Replies View Related

ConnectionString Property Has Not Been Initialized

Nov 18, 2005

My IT dept set up an SQL db on a server for me and I am connected to it through a port.  They told me I had to create my tables through an MS Access adp, which I have done.  I am using VWD Express and am trying to create a login page using usernames and pw's from a db table. I am connected (at least the db Explorer tab shows I am) to the MS Access adp and can drop a GridView from my Employees table from it onto a page and get results.  I keep getting the "ConnectionString property not initialized" error message pointing to my sqlConn.Open() statement and cannot figure out why.  I have looked at hundreds of posts but can't seem to find anything that works.  If someone could point me to some post or website that could explain connecting to a SQL db through a port or whatever you think I need to learn to get this fixed I would appreciate it. Web config:
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<appSettings/>
<connectionStrings>
<add name="ASPNETDB" connectionString="Description=Training;DRIVER=SQL Server;SERVER=USAWVAS27;UID=usx14611;APP=Microsoft® Visual Studio® 2005;WSID=983QD21;Network=DBMSSOCN;Address=USAWVAS27,3180;Trusted_Connection=Yes" providerName="System.Data.Odbc" />
</connectionStrings>

<system.web>
<authentication mode="Forms" />



<authorization>
<deny users="?" />
</authorization>
<customErrors mode="Off" />


</system.web>
</configuration>My login.aspx page
<%@ Page Language="VB" debug="true"%>
<%@ Import Namespace="System.Data.SqlClient" %>
<%@ Import Namespace="System.Configuration.ConfigurationManager" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">

Protected Sub LoginUser(ByVal s As Object, ByVal e As EventArgs)
Dim blnAuthenticate As Boolean = Authenticate(username.Text, password.Text)
If blnAuthenticate Then
FormsAuthentication.RedirectFromLoginPage(username.Text, False)
End If
End Sub
Function Authenticate(ByVal strUsername As String, ByVal strPassword As String) As Boolean

Dim strConnection As String = ConfigurationManager.AppSettings("ASPNETDB")
Tried this code as wellDim sqlConn As New SqlConnection(ConfigurationManager.AppSettings("ASPNETDB"))
Dim sqlConn As New SqlConnection(strConnection)

Dim sqlCmd As SqlCommand
Dim sqlDR As SqlDataReader
Dim userFound As Boolean
sqlCmd = New SqlCommand("SELECT * FROM Employees " & _
"WHERE username='" & strUsername & " ' AND password='" & strPassword & "'", sqlConn)



sqlConn.Open()
sqlDR = sqlCmd.ExecuteReader()
userFound = sqlDR.Read()
sqlDR.Close()
Return userFound
End Function
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<p>Username:<asp:TextBox ID="username" runat="server"></asp:TextBox><br />
<br />
<p>Password:<asp:TextBox ID="password" runat="server"></asp:TextBox><br />
<br />
<asp:Button ID="btnSubmit" runat="server" Text="Login" OnClick="LoginUser" />&nbsp;</div>
</form>
</body>
</html>Thanks

View 5 Replies View Related







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