Retrieve Data From A SQLDatasource Object.

May 21, 2007

I'm an "old" programmer but new to ASP.NET.

I want to get a value from the SQL Dataset.

What I would normally do in other environments is iterate through the dataset to get the value I would be intrested in, but I can't figure out how to do this without using a visual data display object like a Grid view.

Typically I want to get a value from the database that I then after manipulating it, like multply by 5, use to format something on the page.

thanks in advance,

Thommie

 

View 3 Replies


ADVERTISEMENT

How To Retrieve Data From Sqldatasource?

Jul 18, 2006

Okay, I used the SQLDataSource control to get my data from the database
table. What or how do I retrieve individual data from the
sqldatasource? I want to do some string comparison and manipulation
before I display it to the browser. How can this be accomplish?

Help is appreciated.

View 21 Replies View Related

Retrieve Data From SQLDataSource

Jan 23, 2008

Background:I am using Visual Studio 2005 Standard SP1 to create an ASP.NET website that accesses an SQL 2005 database.  I am using vb.net as well.I am passing an ID in a query string from one page to the next, where I retrieve it using an SQLDataSource.  The data will only be one row; it is returning customer information.Problem:I need to be able to get specific fields from the SQLDataSource and populate some textboxes.  Honestly, I'm not really sure where to begin.  For the sake of argument, let's say that I am working with this:'My TextboxDim LastName As Textbox'My SQLDataSource (filtered by query string using the customer's ID to only get 1 customer's information at a time)SQLDataQuestion:So, how would I go about retrieving the lastname field from SQLData and inserting it into the textbox LastName?Thanks,    J'Tok

View 2 Replies View Related

How To Retrieve Data From A SQLDataSource Control

Jun 10, 2007

I have made a SQLDataSource control with the select command:
SELECT COUNT(*) AS 'Antall' FROM Utgivelse WHERE (medieID = @medieID)
I want to use the "Antall" result programmatically in C# code. I try the following statement:        IDataReader MyReader;
 
       MyReader = CType(SqlDataSource2.Select(DataSourceSelectArguments.Empty),IDataReader);
but it doesnot work. Can somebody help me how to get the data from th control ?
Tom

View 2 Replies View Related

How To Retrieve Data From Sqldatasource To Textbox

Sep 4, 2007

 my problem is i can't retrieve data from my sqldatasource to be displayed in textbox... i try to do it in vb codes. somebody help me here?

View 4 Replies View Related

Updating Data With SqlDataSource Object

Mar 6, 2007

I am updating data with sqlDatasource but it is inserting NULL, tell what I am missing <asp:FormView ID="FormView1" runat="server" DataSourceID="SqlDataSource1"
DefaultMode="Insert" Width="100%">
<InsertItemTemplate>
<table width="100%">
<tr>
<td style="width: 100px">
Name</td>
<td style="width: 100px">
<asp:TextBox ID="txtCategory" runat="server" Text='<%# Eval("CategoryName") %>'></asp:TextBox></td>
</tr>
<tr>
<td style="width: 100px">
Parent</td>
<td style="width: 100px">
<asp:DropDownList ID="ddlParent" runat="server" DataSourceID="SqlDataSource1" DataTextField="CategoryName" DataValueField="CategoryID" Width="100%">
</asp:DropDownList></td>
</tr>
<tr>
<td style="width: 100px">
</td>
<td style="width: 100px">
<asp:Button ID="btnAdd" runat="server" Text="Add" CommandName="Insert"/></td>
</tr>
</table>
</InsertItemTemplate>
</asp:FormView>


<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:CommerceTemplate %>"
SelectCommand="SELECT [CategoryID], [CategoryName], [CategoryMID] FROM [CMRC_Categories]"
DeleteCommand="DELETE FROM [CMRC_Categories] WHERE [CategoryID] = @CategoryID"
InsertCommand="INSERT INTO [CMRC_Categories] ([CategoryName], [CategoryMID]) VALUES (@CategoryName, @CategoryMID)"
UpdateCommand="UPDATE [CMRC_Categories] SET [CategoryName] = @CategoryName, [CategoryMID] = @CategoryMID WHERE [CategoryID] = @CategoryID">
<DeleteParameters>
<asp:Parameter Name="CategoryID" Type="Int32" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="CategoryName" Type="String" />
<asp:Parameter Name="CategoryID" Type="Int32" />
<asp:Parameter Name="CategoryMID" Type="Int32" />
</UpdateParameters>
<InsertParameters>
<asp:FormParameter Name="CategoryName" Type="String" FormField="txtCategory" />
<asp:FormParameter Name="CategoryMID" Type="Int32" />
</InsertParameters>
</asp:SqlDataSource> Please suggest  cheers
  

View 4 Replies View Related

Object Explorer Connection Fails - Failed To Retrieve Data.......SmoEnum)

Oct 17, 2006

Hi

First up - my apologies if this is not the right forum for this question. Please let me know if there is a more appropriate one for this question.

I have come across an issue with my SQL Server 2005 Express Edition install. It has been running fine since the install (a few months back). And I can still interact (query, update etc) the databases just fine. However, SQL Management Server Studio Express has started to produce an error message when I attempt to connect the Object Explorer.

The error message is shown below.

I have tried to access the link shown in the error message but there is no information provided there.

I can use SQL Management Server Studio Express to run queries on the databases so it would appear that the underlying services are all running OK.

The SQL Server is installed using SQL Authentication only and I have not made any changes to Service accounts or the services themselves. The protocols all appear to be in order too - Shared Memory, Named Pipes, TCP/IP are all enabled.

I have restarted the SQL services and even rebooted the machine, but to no avail.

I would really appreciate if anyone out there could give me some guidance on what may be causing this issue.

Note: The SQL Server is installed on WinXP Pro SP2 running in a VirtualPC. All apps are release versions (no beta or CTP)





TITLE: Microsoft SQL Server Management Studio Express
------------------------------

Failed to retrieve data for this request. (Microsoft.SqlServer.Express.SmoEnum)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&LinkId=20476

------------------------------
ADDITIONAL INFORMATION:

An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.Express.ConnectionInfo)

------------------------------

A severe error occurred on the current command. The results, if any, should be discarded.
A severe error occurred on the current command. The results, if any, should be discarded. (Microsoft SQL Server, Error: 0)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=0&LinkId=20476

------------------------------
BUTTONS:

OK
------------------------------

View 10 Replies View Related

RETRIEVE VALUE AFTER ADD FROM SQLDATASOURCE

Jun 29, 2007

I am using an SQLDataSource to add a product, this works fine, but I would like to know what syntax is used to retrieve the product ID in this case which is return by the SPROC
 
Thanks
 
Steve

View 1 Replies View Related

How To Retrieve Datas From A SqlDataSource

Jan 11, 2006

Hi! I'm a novice in asp .net
I've a SqlDataSource component on an Aspx page.In the associated C# file, I would like to use datas from the query stored in the SqlDataSource component.How to do this?
Thanxs :)

View 2 Replies View Related

How Do I Retrieve The IDENT_CURRENT Value Of A Table Using An SqlDataSource?

Dec 8, 2005

Hi
I am trying to get the last ID value of a table. 
The following code worked when a SQLConnection object was used, how do I achieve the same result using an SQLDataSource?
this.sqlSelectCmd2 = new System.Data.SqlClient.SqlCommand("SELECT IDENT_CURRENT('Assets')",sqlConnection1);
sqlConnection1.Open();
int nID = Convert.ToInt32( this.sqlSelectCmd2.ExecuteScalar() ) ;
nID++;
dc.FocusedRow["ID"] = nID.ToString();
Cheers
Pen
 

View 1 Replies View Related

Stored Procedure That Retrieve Object Name

May 10, 2004

Hi to all!
Is there a system stored procedure that retrieve info or name about an object?
I must know if a database contains a specific table and i must know if there is a specific DTS.. before execute it..
someone could help me??

thx a lot!

Ale.
Sorry for my poor english!!


bye! =)

View 2 Replies View Related

SqlDataSource.Select Error: Unable To Cast Object Of Type 'System.Data.DataView' To Type 'System.String'.

Oct 19, 2006

I am trying to put the data from a field in my database into a row in a table using the SQLDataSource.Select statement. I am using the following code: FileBase.SelectCommand = "SELECT Username FROM Files WHERE Filename = '" & myFileInfo.FullName & "'" myDataRow("Username") = CType(FileBase.Select(New DataSourceSelectArguments()), String)But when I run the code, I get the following error:Server Error in '/YorZap' Application. Unable to cast object of type 'System.Data.DataView' to type 'System.String'. 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. Exception Details: System.InvalidCastException: Unable to cast object of type 'System.Data.DataView' to type 'System.String'.Source Error: Line 54: FileBase.SelectCommand = "SELECT Username FROM Files WHERE Filename = '" & myFileInfo.FullName & "'"
Line 55: 'myDataRow("Username") = CType(FileBase.Select(New DataSourceSelectArguments).GetEnumerator.Current, String)
Line 56: myDataRow("Username") = CType(FileBase.Select(New DataSourceSelectArguments()), String)
Line 57:
Line 58: filesTable.Rows.Add(myDataRow)Source File: D:YorZapdir_list_sort.aspx    Line: 56 Stack Trace: [InvalidCastException: Unable to cast object of type 'System.Data.DataView' to type 'System.String'.]
ASP.dir_list_sort_aspx.BindFileDataToGrid(String strSortField) in D:YorZapdir_list_sort.aspx:56
ASP.dir_list_sort_aspx.Page_Load(Object sender, EventArgs e) in D:YorZapdir_list_sort.aspx:7
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +13
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +45
System.Web.UI.Control.OnLoad(EventArgs e) +80
System.Web.UI.Control.LoadRecursive() +49
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3743
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.210 Please help me!

View 3 Replies View Related

Using A SQLDataSource Object

May 29, 2008

If a page contains a SQLDataSource object with a connection string that works on other pages, can that datasource be used in the codebehind to create a DataReader thereby avoiding the need to DIM and create a new connection string? My code fails but I can't figure out what to try next. Thanks.
   Dim queryString As String = "SELECT * FROM users "
Using SqlDataSource1
Dim command As New Data.SqlClient.SqlCommand(queryString)
Dim oReader As Data.SqlClient.SqlDataReader = command.ExecuteReader()

' Call Read before accessing data.
While oReader.Read()
Console.WriteLine(String.Format("{0}, {1}", oReader(0), oReader(1)))
End While

' Call Close when done reading.
oReader.Close()
End Using 

View 9 Replies View Related

SqlDataSource Object Question

Apr 7, 2007

Hello, thanks for reading my post!
 
 Ok, so I connected to my database. I can insert data and all that good stuff, but when it comes time to make the login page for a project I am working on, sadly I cant figure out how to read data from my datasource object O_O.
 So I have an SqlDataSource object, its bound to my sql database ( successfully ), I can even set it to return the results I want, my question though is how do I access the results it returns so I can compair it with code?
 Hope I'm making sense! Any help is *greatly* appreciated!
 Thanks!,
 -Bob

View 2 Replies View Related

Can I Configure A SQLDataSource Object To Use.....

Nov 8, 2007

.. the Membership ProviderUserKey value as the parameter of a stored procedure ?It seems obvious to me that you would want to do this, but I can only see that it allows you to pass Profile parameters. 

View 2 Replies View Related

Setting The Value Of A SqlDataSource.SelectParameter Object

Sep 13, 2006

I am trying to set the value of a SqlDataSource parameter named "InvestmentGroup" with the following code:ProjectData.SelectParameters["InvestmentGroup"] = Request.QueryString[0];ProjectData.DataBind();When I try this, I get an error saying that the right side is a string and the left side is not....but I cannot find a property of the SelectParameters["InvestmentGroup"] object like Value or something that would allow me to set the value of the parameter with a string. Please help!

View 4 Replies View Related

Refresh An SQLDataSource Object Programmatically

Oct 27, 2006

Background - I have a page that uses a numeric value stored in a Session object variable as the parameter for three different SQLDataSource objects, which provide data to two asp:Repeaters and an asp:DataList.  Also, in the Page_Load, I use this value to to seed a stored procedure and an SQLDataReader to populate several unbound Labels.  This works fine.  In addition, I have a collection of 6 TextBoxes, an unbound Listbox, and two Buttons to allow the user to do searching and selection of potential matches.  This basically identifies a new numeric value that I store in the Session variable and PostBack the page (via one of the buttons).  This also works fine.Problem - I have been tasked with taking a different page and adding six textboxes to collect the search values, but to post over to this page, populate the existing search-oriented TextBoxes, adn programmatically triggering the search.  Furthermore, I have to detect the number of matching records and, if only 1, have the Repeaters and DataList display the results based on the newly selected record's key numeric value, as well as populating the unbound Labels.  I have managed to get all of this accomplished except for programmatically triggering the Repeaters and DataList "refresh".  These controls only populate as expected if a button is clicked a subsequent time, which makes sense, since that would trigger a PostBack and the Page_Load uses the new saved numeric key value from the Session.My history in app development is largely from Windows Forms development (VB6), this is my second foray into Web Form dev with ASP.NET 2.0.  I am willing to acceptthat what I am trying to do does not fit into the ASP environment, but I have to think that this is something that has been done before, and (hopefully) there is a way to do what I need.  Any ideas, oh great and wise Forum readers? *smile* 

View 3 Replies View Related

Using A Custom Object As Sqldatasource Parameter

Dec 29, 2007

hi i want to select data based on a user id, which is stored in a custom object->   sessionhandler.user.id
how can i put that in the select parameter?
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:RentTodaySQL %>" DeleteCommand="DELETE FROM [Rentals] WHERE [RentalID] = @original_RentalID"
InsertCommand="INSERT INTO [Rentals] ([Headline], [Description], [MoveInSpecial], [MonthlyCost], [Deposit], [AvailableDate], [FeaturedListing], [UserID], [Address], [Address2], [City], [State], [Zip], [LeaseTermID], [LeaseDetails], [Section8], [Section8Details], [PetsAllowed], [PetsDetails], [PetDeposit], [ApplicationFee], [ApplicationDetails], [SmokingAllowed], [RentalCategoryID], [Bedrooms], [Bathrooms], [SqFootage], [LotSize], [YearBuilt], [DefaultImageID]) VALUES (@Headline, @Description, @MoveInSpecial, @MonthlyCost, @Deposit, @AvailableDate, @FeaturedListing, @UserID, @Address, @Address2, @City, @State, @Zip, @LeaseTermID, @LeaseDetails, @Section8, @Section8Details, @PetsAllowed, @PetsDetails, @PetDeposit, @ApplicationFee, @ApplicationDetails, @SmokingAllowed, @RentalCategoryID, @Bedrooms, @Bathrooms, @SqFootage, @LotSize, @YearBuilt, @DefaultImageID)"
OldValuesParameterFormatString="original_{0}" SelectCommand="SELECT * FROM [Rentals] WHERE ([UserID] = @UserID)"
UpdateCommand="UPDATE [Rentals] SET [Headline] = @Headline, [Description] = @Description, [MoveInSpecial] = @MoveInSpecial, [MonthlyCost] = @MonthlyCost, [Deposit] = @Deposit, [AvailableDate] = @AvailableDate, [FeaturedListing] = @FeaturedListing, [UserID] = @UserID, [Address] = @Address, [Address2] = @Address2, [City] = @City, [State] = @State, [Zip] = @Zip, [LeaseTermID] = @LeaseTermID, [LeaseDetails] = @LeaseDetails, [Section8] = @Section8, [Section8Details] = @Section8Details, [PetsAllowed] = @PetsAllowed, [PetsDetails] = @PetsDetails, [PetDeposit] = @PetDeposit, [ApplicationFee] = @ApplicationFee, [ApplicationDetails] = @ApplicationDetails, [SmokingAllowed] = @SmokingAllowed, [RentalCategoryID] = @RentalCategoryID, [Bedrooms] = @Bedrooms, [Bathrooms] = @Bathrooms, [SqFootage] = @SqFootage, [LotSize] = @LotSize, [YearBuilt] = @YearBuilt, [DefaultImageID] = @DefaultImageID WHERE [RentalID] = @original_RentalID">
<SelectParameters>
<asp:Parameter DefaultValue="<%= SessionHandler.User.ID %>" Name="UserID" Type="Int32" />
</SelectParameters>
 

View 1 Replies View Related

Passing SqlDataSource Object An Array As A Parameter

Feb 22, 2007

Hi,
I am trying to get the selected options from a listbox and either pass a SqlDataSource object the array or loop through it and pass each element of the array. I then need to modify the returned databtable to graphing function, but first drop the last column. I was wondering if anyone can help me with the following:
1. Pass an array into SqlDataSource Select OR 2. Pass a single argument into the Select statement and populate a datatable without it writing over the current row each time it iterates through the foreach statement. I am looking for the dataview to append to dt each time it loops. Is there a property for dataview that behaves like the "ClearBeforeFill" for table adapters?3. Update a parameter programmatically
Below code works, but I think it can be more efficient. Any suggestions would be greatly appreciated.
Thanks in advance!!
 
 
        DataTable dt = new DataTable();        DataTable dt2 = new DataTable();        DataView dv = new DataView();                        
       foreach(ListItem liOptions in ListBox1.Items)       {             if(liOptions.Selected)             {                                      SqlDataSource1.SelectParameters.Add("Parameter1", liOptions);                   dv = (DataView)SqlDataSource1.Select(DataSourceSelectArguments.Empty);                   dt2 = dv.Table;                   dt.Merge(dt2);                   dt2.Dispose();                   SqlDataSource1.SelectParameters.Clear();             }       }
        if (dt.Rows.Count > 0)        {           Graph(dt);                             //Pass original datatable (dt) to Graph();           dt.Columns.RemoveAt(2);      //Reformat datatable (dt) and remove last column before binding to Gridview1
           GridView1.DataSource = dt;           GridView1.DataBind();        } else {
    errorMessage.Text = "No data was returned!"; }

View 3 Replies View Related

Object Reference Not Set To An Instance Of An Object When Retrieving Data/Schema In Design Time

Oct 11, 2006

Hi There,This is related to a ms access database but since I use the SqlDataSource control I thought I should post here.I have a project that I was working on with this ms access db and using sql controls, everything was working just finesince one day I started getting "Object reference not set to an instance of an object" messages when I try to designa query or retrieve a schema,  nothing works at design time anymore but at runtime everything is perfect, its a lotof work for me now to create columns,schemas and everything manually, I've tried reinstalling visualstudio, ado componentsbut nothing seems to fix it, did this ever happen to any of you guys?any tip is really appreciated  thanks a lot 

View 2 Replies View Related

Object Reference Not Set To An Instance Of An Object (Inserting Data Into Database)

Dec 28, 2004

Each time I press submit to insert data into the database I receive the following message. I use the same code on another page and it works fine. Here is the error:


Object reference not set to an instance of an object.
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.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:


Line 125: MyCommand.Parameters("@Balance").Value = txtBalance.Text
Line 126:
Line 127: MyCommand.Connection.Open()
Line 128:
Line 129: Try


Source File: c:inetpubwwwrootCreditRepairCreditor_Default.aspx.vb Line: 127

Stack Trace:


[NullReferenceException: Object reference not set to an instance of an object.]
CreditRepair.CreditRepair.Vb.Creditor_Default.btnSaveAdd_Click(Object sender, EventArgs e) in c:inetpubwwwrootCreditRepairCreditor_Default.aspx.vb:127
System.Web.UI.WebControls.Button.OnClick(EventArgs e)
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
System.Web.UI.Page.ProcessRequestMain()



Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click

If (Page.IsValid) Then

Dim DS As DataSet
Dim MyCommand As SqlCommand

Dim AddAccount As String = "insert into AccountDetails (Account_ID, Report_ID, Balance) values (@Account_ID, @Report_ID, @Balance)"

MyCommand = New SqlCommand(AddAccount, MyConnection)

MyCommand.Parameters.Add(New SqlParameter("@Account_ID", SqlDbType.Char, 50))
MyCommand.Parameters("@Account_ID").Value = txtAccount_ID.Text

MyCommand.Parameters.Add(New SqlParameter("@Report_ID", SqlDbType.Char, 50))
MyCommand.Parameters("@Report_ID").Value = txtReport_ID.Text

MyCommand.Parameters.Add(New SqlParameter("@Balance", SqlDbType.Char, 50))
MyCommand.Parameters("@Balance").Value = txtBalance.Text

MyCommand.Connection.Open()

MyCommand.ExecuteNonQuery()

Response.Redirect("Customer_Details.aspx?SS='CustHeadGrid.Columns[0].Item.lblSS.Text)")

MyCommand.Connection.Close()
End If

View 2 Replies View Related

Asp.net Page Is Unable To Retrieve The Right Data Calling The Store Procedure From The Dataset/data Adapter

Apr 11, 2007

I'm trying to figure this out
 I have a store procedure that return the userId if a user exists in my table, return 0 otherwise
------------------------------------------------------------------------
 Create Procedure spUpdatePasswordByUserId
@userName varchar(20),
@password varchar(20)
AS
Begin
Declare @userId int
Select @userId = (Select userId from userInfo Where userName = @userName and password = @password)
if (@userId > 0)
return @userId
else
return 0
------------------------------------------------------------------
I create a function called UpdatePasswordByUserId in my dataset with the above stored procedure that returns a scalar value. When I preview the data from the table adapter in my dataset, it spits out the right value.
But when I call this UpdatepasswordByUserId from an asp.net page, it returns null/blank/0
 passport.UserInfoTableAdapters oUserInfo = new UserInfoTableAdapters();
Response.Write("userId: " + oUserInfo.UpdatePasswordByUserId(txtUserName.text, txtPassword.text) );
 Do you guys have any idea why?
 
 

View 6 Replies View Related

How?retrieve Data From Table1 Then Save The Retrive Data To Table2...

May 8, 2008

Good day., please help me,in a formview control, i set it in Insert Mode, so it should display info from table 1 but when i click on the insert button, it will insert it in table 2.btw, table 1 and table 2 are in the same database?? how about if they are not in the same database?how?please help me,Thanks.,SALAMAT PO., 

View 3 Replies View Related

Retrieve Text File Data In SSE For Data Acquisition System

Oct 24, 2007

Hey All,
I am developing a data acquistion system which monitors the amount of energy that a user consumes in different parts of a house and displays the information in real time on their computer screen. I am collecting the data through tranducers attached to the circuit breakers in the breaker box and sending the data to analog-to-digital converter channels in a MCU. I am retrieving the data from the serial port and storing it to a text file. Each line of data in the text file represents three fields which are separated by commas. I will be reading data from multiple data collection boxes so the first field is the unit number, the second fied represents the analog-to-digital converter channel number from each unit, and the third field is the data that is collected from the ATD channel. I am trying to use SSE to retrieve the data from the text file, and parse each line of data into individual columns in a databse. Then I want to be able to extract the data associated with a particular ATD channel number from the databse and display it in the appropriate text field on a windows form.
I've got the MCU programmed. I have no problem collecting the data from the serial port, and I can do the visual basic programming okay. I have absolutely no clue how to read the data into the database, continuosly read new values into the databse, and then access the stored data to update the text fields on the form. Please help if you can, I've been working on this specific problem for a couple of weeks and I'm not making any progress. Thanks.

View 3 Replies View Related

Retrieve Text File Data In SSE For Data Acquisitio

Oct 24, 2007

Hey All,
I am developing a data acquistion system which monitors the amount of energy that a user consumes in different parts of a house and displays the information in real time on their computer screen. I am collecting the data through tranducers attached to the circuit breakers in the breaker box and sending the data to analog-to-digital converter channels in a MCU. I am retrieving the data from the serial port and storing it to a text file. Each line of data in the text file represents three fields which are separated by commas. I will be reading data from multiple data collection boxes so the first field is the unit number, the second fied represents the analog-to-digital converter channel number from each unit, and the third field is the data that is collected from the ATD channel. I am trying to use SSE to retrieve the data from the text file, and parse each line of data into individual columns in a databse. Then I want to be able to extract the data associated with a particular ATD channel number from the databse and display it in the appropriate text field on a windows form.
I've got the MCU programmed. I have no problem collecting the data from the serial port, and I can do the visual basic programming okay. I have absolutely no clue how to read the data into the database, continuosly read new values into the databse, and then access the stored data to update the text fields on the form. Please help if you can, I've been working on this specific problem for a couple of weeks and I'm not making any progress. Thanks.

View 1 Replies View Related

Unable To Cast Object Of Type 'System.Object' To Type 'System.Data.DataSet'.

Nov 27, 2007



hi i dont know how to do type casting.

this.Variables.ObjVariable this objVariables i have create in variable place below like this



Name:Variable datatype int32 values 0

Name: NumberofRowsdatatype int32 values 10000

Name: ObjVariable datatype Object



My code





public override void CreateNewOutputRows()

{

/*

Add rows by calling the AddRow method on the member variable named "<Output Name>Buffer".

For example, call MyOutputBuffer.AddRow() if your output was named "MyOutput".

*/

System.Data.OleDb.OleDbDataAdapter oLead = new System.Data.OleDb.OleDbDataAdapter();

//System.Data.Odbc.OdbcDataAdapter oLead = new System.Data.Odbc.OdbcDataAdapter();

//SqlDataAdapter oLead = new SqlDataAdapter();

System.Data.DataTable dt = new System.Data.DataTable();

DataSet ds = (DataSet)this.Variables.ObjVariable; // here i am getting error

ds.Tables.Add(dt);


ADODB.Record rs = new ADODB.Record();



oLead.Fill(ds, rs, "Variables");

foreach (DataRow row in dt.Rows)

{

{

Output0Buffer.AddRow();

Output0Buffer.Column = (int)row["Column"];

Output0Buffer.Column1 = row["Column1"].ToString();

Output0Buffer.Column2 = row["Column2"].ToString();

}

}


}

}

This is the error

Unable to cast object of type 'System.Object' to type 'System.Data.DataSet'.

at ScriptMain.CreateNewOutputRows()

at UserComponent.PrimeOutput(Int32 Outputs, Int32[] OutputIDs, PipelineBuffer[] Buffers)

at Microsoft.SqlServer.Dts.Pipeline.ScriptComponentHost.PrimeOutput(Int32 outputs, Int32[] outputIDs, PipelineBuffer[] buffers)



thanks

kedaranth

View 5 Replies View Related

Retrieve Data

Jan 18, 2008

I need to retrieve points column from my database for the specific user that is signed on and sum all of them. How can I do it using the Gridview and also code in vb for a label? Thanks.  

View 4 Replies View Related

How Can I Retrieve Data?

Nov 19, 2005

Here is my sql procedure:
ALTER PROCEDURE dbo.SoftWareShow /* ( @parameter1 int = 5, @parameter2 datatype OUTPUT ) */ @SoftID uniqueidentifierAS SELECT [SoftID], [SoftName], [SoftJoinDate], [SoftSize], [SoftMode], [SoftRoof], [SoftHome], [SoftDemo], [SoftFirstClassID], [SoftSecondClassID], [SoftDesc], [SoftReadCount], [SoftDownCount],ltrim(rtrim([SoftUrlOne])) SoftUrlOne, ltrim(rtrim([SoftUrlTwo])) SoftUrlTwo, ltrim(rtrim([SoftUrlThree])) SoftUrlThree, ltrim(rtrim([SoftUrlFour])) SoftUrlFour FROM [SoftWare] WHERE ([SoftID] = @SoftID) RETURNwhere I retrieve data using sqldatasource, an error appear. how can do ?

View 1 Replies View Related

Retrieve Data

Mar 18, 2008

Hello,

Before I ask a question, I am visually impaired and cannot read printed words only on a screen. I am 51 years old and have been coding professionally since I was 23 (yes that long). I have four apps on the market and run a small consultancy company in the UK and my SQL knowledge is scant. I have read two books on the subject and thought I had an idea on how SQL works.

I used to belong to another forum but they gave me a hard time so please go easy on me.

I developed an ADO app ages ago and remembered some of it ...

I have four tables (the following is a simplified version of the real thing)

MainTable (Contact data like name address etc. 23 fields)
Towns (Two fields TownUIN and TownName)
Counties (Two fields CountyUIN and CountyName)
Countries (Two fields CountryUIN and CountryName)

My database is normalised to 3NF and contains no duplicate or redundant data.

My problem ...

Sample data

Main:
MainUIN MainName MainTown
1000 Fred Bloggs 1
1001 Fred Smith 2

Towns:
TownUIN TownName
1 Bradford
2 Leeds

SELECT MainName,MainTown FROM Main WHERE MainUIN=1000 returns
'Fred Bloggs' 1 (the TownUIN)

I want ...
'Fred Bloggs' 'Bradford'

It was suggested I use
SELECT MainName,MainTown FROM Main,Towns WHERE MainUIN=1000 AND TownUIN=MainTown
This returned 'Fred Bloggs' 'Bradford' but was slow.

My question is what am I doing wrong?

I am using SQL Server 2005 Express with VB.Net 2005 on Vista Business and XP.

I am sorry my SQL knowledge is weak please dont get angry just tell me the basic thing that I do not know.

View 7 Replies View Related

Cannot Retrieve Data In Utf-8 From Php

Jul 20, 2005

Hi.I have a IIS server with php3 installed. I have SQL server databaseand data stored in unicode format (nvarchar fields). In header of myphp I have the meta: <meta HTTP-EQUIV="content-type"CONTENT="text/html; charset=UTF-8">.I have the following problem:- I trie to do a query using ODBC (version 3.525.1022.0) and SQLServer odbc driver (version 200.85.1022.00). The query doesn'tretrieve information in utf format and accents and extra charactersaren't showed correctly.- I trie to di the query usin native OLE DB. I use mssql funtions andthe problem is the same.If I install php4 and I use "newCOM("ADODB.Connection",NULL,CP_UTF8);", then it works correctly.Anybody knows if its posible to retrieve data from sql-server in utf-8format using php3?I see in other postings that odbc driver only accept utf-8 in version3.7 or higher? Is it true? If is true, where I can download odbcdriver 3.7?Thank's in advance.Miki.

View 1 Replies View Related

Data Access :: Remote Data Object In VB5 To Get Current Login User?

Jul 13, 2015

I'm using a legacy application built using VB5 and SQL Server 7. After recompiling it, and putting the database in SQL Server 2012. I want to access the current login user using the SQL function SUSER_SNAME().

This is the code.

Set rdoRes = goDatabase.Connection.OpenResultset("select suser_sname()")

But I'm unable to get the current user login in the application. If I write any other SQL statement instead of this, then it runs. But only this statement is not running. Is there any security reasons for this?

View 8 Replies View Related

Retrieve Data From The Gridview

Jun 19, 2006

i need to retrieve data from a particular field of the gridview according to the selected row to stored it into session .....what i had done so far as following: Protected Sub GridView1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)        DetailsView1.PageIndex = GridView1.SelectedIndex        Session.Add("receiverName", GridView1.??????)            End Sub????? is the part i am not sure what to code.... i tried different method by seems to have problem of convertion.

View 1 Replies View Related

How To Retrieve Data As XML From SQL Database

Feb 28, 2007

Hi,
I have a website which is designed to search for employee information. I have the search system working which does exactly what I want to, but as an added feature I want there to be a button which, when someone clicks on it, it takes whatever the previous search was and generates a set of data in XML format which is based on the results. For example:
User searches for all entries with Forename = John; Results are listed in a gridview as per expected.
User then presses button with XML on it, and page pops up with just the XML output on it, i.e. whatever results are on the gridview but in a nested XML format
<records>    <record>       <Forename>John</Forename>       <Surname>Smith</Surname>       <Email>j.smith@blah.com</Email>       <Ext>1234</Ext>       <DeptList>History</DeptList>    </record></records>
I have created a stored procedure which will take the parameters from the search boxes and return the above information, but I don't know if this is the best way. Here it is for those interested:
CREATE PROCEDURE ps_record_SELECT_NameSurnameEmailExtDeptasXML
@Forename varchar(50),
@Surname varchar(50),
@Email varchar(50),
@Ext varchar(4),
@DeptList varchar(50)
AS
SELECT Forename, Surname, Email, Ext, DeptList
FROM dbo.record
WHERE Forename LIKE COALESCE(@Forename,Forename) AND
Surname LIKE COALESCE(@Surname,Surname) AND
Email LIKE COALESCE(@Email,Email) AND
Ext LIKE COALESCE(@Ext,Ext) AND
DeptList LIKE COALESCE(@DeptList,DeptList)
FOR XML AUTO, ELEMENTS
If someone could be kind enough to help me out with this, I'd be really grateful.
Many thanks,
Tom

View 2 Replies View Related







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