Showing posts with label extract. Show all posts
Showing posts with label extract. Show all posts

Tuesday, March 27, 2012

datasource question

im using this datasource to extract values from a database.

i simply want to extract the values for ratingsum and ratingcount to populate variables so as to be checked within a code loop.

how do i do this? in classis asp would be something like <%=rsRecords(RatingSum)%
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:MyConnectionString %>"
ProviderName="<%$ ConnectionStrings:MyConnectionString.ProviderName %>" SelectCommand="SELECT SUM(rating) As RatingSum, COUNT(*) As RatingCount FROM tbl_Rating WHERE Itemid=100">
</asp:SqlDataSource>

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim dv As System.Data.DataView = CType(SqlDataSource1.Select(DataSourceSelectArguments.Empty), System.Data.DataView)


If dv.Count > 0 Then
Dim myvalue = dv(0).Item("RatingSum")
Dim myvalue2 = dv(0).Item(1) 'orItem("RatingCount")
Label2.Text = CType(myvalue, Int16) & "*************Count=" & CType(myvalue2, Int16)

Else
Label2.Text = "not data!"

End If


End Sub

This way you can send the value back from your code. In this case from the label.text.

You can also use this section within your select parameter to bind your where clause parameter to a textbox control instead of the hard-coded value.

<SelectParameters>
<asp:ControlParameter ControlID="TextBox1" Name="itemId" PropertyName="Text" Type="int16" />

</SelectParameters>

Thursday, March 8, 2012

Dataflow Tab:There is no ODBC Source option in the Toolbox

I need to extract data from tables in a database that I can only access via ODBC.

I have successfully created a connection in Connection Manager (ConnectionManagerType = ODBC) for this database.

However I’m unable to add this connection as a Data Flow Source. There is no ODBC Source option in the Toolbox.

This is a major because we have been using the system dsn Microsoft Visual Foxpro Driver to access free table directory .dbf files under ODBC with DTS for years. To install a new Microsoft OLEDB driver for foxpro is out of the question on a production system as it would cost many thousands of dollars to go through our BAT testing process

How do I extract data from tables in a database via ODBC?

Thanks in advance

Dave

There is too, though it's not marked as such. Use the Data Reader Source.|||

You can use the script component as source.

|||

Thanks for that the data reader souce can actually use a ODBC source. I have it working fine.

I do think there is a peformance overhead and its slower than the ODBC connector in DTS.

|||

well that is interesting How can it connect to a foxpro file .dbf and matching .fpt file the .fpt files are used for memo text fieldsthe foxprpro ODBC driver does this for you behind the scenes

|||

Vijay Thirugnanam wrote:

You can use the script component as source.

True, though it shouldn't be faster than using the prepackaged source connectors.

Friday, February 17, 2012

database user post extraction

please can anyone help me i have a ipb forum some how i accidently delete my post i have a old backup from 3 week ago how can i extract the post from the backup
NOTE: the only post that was deleted was post made by me none of the other member post was deleted
i did not want to restore the entire post table beacause i would loose post in the past 3 weeks
can anyone help me with a script or anything i can used to extract post of the post table where the poster id is 1
here is a sample

INSERT INTO `ibf_posts` VALUES (2, 0, NULL, 1, 'albertldee', 1, 1, '12.8.34.199'
INSERT INTO `ibf_posts` VALUES (3, 0, NULL, 4, '??-?', 1, 1, '207.44.154.35
INSERT INTO `ibf_posts` VALUES (4, 0, NULL, 6, 'demarcus', 1, 1, '69.142.131.149
INSERT INTO `ibf_posts` VALUES (5, 0, NULL, 7, 'gottasteu', 1, 1, '65.12.169.41

the post table has about 122000 line like above i just want to extract all the line that has albertldee like line number 1Try something like:
INSERT INTO ibf_posts
SELECT * FROM ibf_posts_backup
WHERE user_id = 'albertldee';
NOTE: Change user_id to the correct column name.

:D|||thanks but how do i set it up|||or can anyone tell me how can i setup a query to check a table and insert a line if it's not already exist|||Post a description of both the 'ibf_posts' and the backup table.
:confused: