Retrieve Data From Different Database

Sep 24, 2007

Hi, Im new to SQL 2005.
I want to know that, any way i can use to get data from different database?

View 2 Replies


ADVERTISEMENT

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

Dropdownlist Retrieve Data From Sql Database

Feb 13, 2008

i have 2 dropdownlist which is  ddlCategory and ddlItem.i want<<< a)both ddl get data from sql db.b)view the data in gridview.   i need code in vb.net to retrieve and post.tq  

View 1 Replies View Related

Retrieve Data From Database And Display It In A Label

Jan 21, 2008

Below is code for inserting data into the database that I know works, so I thought if I replace  "Insert" with "Select" I could retrieve a specific row from my database and present it in a label or text box but nothing happened. How can I retrieve a row or rows from a database using vb code and display it in a textbox? I'm using visual web developer 2008 which is similar to 2005.
Thank you.
 
 Dim UserDatasource As New SqlDataSourceUserDatasource.ConnectionString = ConfigurationManager.ConnectionStrings("ASPNETDBConnectionString1").ToString()
 
UserDatasource.InsertCommandType = SqlDataSourceCommandType.Text
UserDatasource.InsertCommand = "insert into table1 (Username, comments, points,totalpoints, ipaddress, datatimestamp) values (@Username, @comments, @points,@totalpoints, @ipaddress, @datatimestamp)"
 
 UserDatasource.InsertParameters.Add("username", Context.User.Identity.Name)
UserDatasource.InsertParameters.Add("comments", txtSearch.Text)UserDatasource.InsertParameters.Add("points", points)
UserDatasource.InsertParameters.Add("ipaddress", Request.UserHostAddress)UserDatasource.InsertParameters.Add("datatimestamp", DateTime.Now())
 Dim rowaffected As Integer = 0
 
Try
rowaffected = UserDatasource.Insert()MsgBox("Thanks for the post", MsgBoxStyle.OkOnly, "Post Executed")
txtSearch.Text = ""Catch ex As Exception
MsgBox("Please sign in or sign up to post comment", MsgBoxStyle.OkOnly, "Login Error")
End Try
 

View 2 Replies View Related

How Can I Retrieve The Data Back Into The Webform From The Database?

Feb 27, 2008

Hi,I m using vwd2005 and sql express,c#.I have a question here.In my database i have a table named Table1(id,name,age,country,email,phone) The values for these fields are inserted from the webform.Id is auto generated.name and age is passed from the textbox within the webform.country is passed from dropdownlist within the webform.email and phone is passed from listbox(multiple email and phone) within the webform.Now my problem is i want to retrieve all these row values back into the textboxes,dropdownlist and listbox at the same timeon the click of the retrieve button within the web form . Further more i want to make few changes on it and update the database on the click of another button update within the form.I hope u are getting it.How would the query would be in this case.?can u demonstrate the concept in one simple running example along with code?thanks.jack. 

View 3 Replies View Related

**I M Not Able To RETRIEVE Data Back Into Webform From The Database?

Mar 25, 2008

Hello Everyone,I 've trying to retreive data back into webform from the database from past couple of weeks.But i m not able to retrieve it completely.Here is my scenario.I've tried to explain in detail but in simple language.I hope u will get my point.Ok here it is.plz run my code:-i have three tables in sql.they are:-grup(id,grp)      (1,abc)      (2,xyz)      organization(id,oid,gid,organisation,orgphone)                  (1,1,1,ibm,1234567)                  (2,1,2,microsoft,6543210)                  (3,2,1,oracle,7654323)                  (4,2,2,apple,9876543)  userform(id,title,name,address,email,organizationid)              (1,mr,jack,usa,jack@jack.com,1) userform.aspx page<%@ Page Language="C#" AutoEventWireup="true" CodeFile="userform.aspx.cs" Inherits="userform" %><!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></head><body>    <form id="form1" runat="server">    <div>        <div style="text-align: center">            <table>                <tr>                    <td style="width: 100px">                        Title</td>                    <td style="width: 100px">                        <asp:DropDownList ID="DropDownList1" runat="server">                            <asp:ListItem>mr</asp:ListItem>                            <asp:ListItem>miss</asp:ListItem>                            <asp:ListItem>ms</asp:ListItem>                        </asp:DropDownList></td>                </tr>                <tr>                    <td style="width: 100px">                        Name</td>                    <td style="width: 100px">                        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox></td>                </tr>                <tr>                    <td style="width: 100px">                        Add</td>                    <td style="width: 100px">                        <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox></td>                </tr>                <tr>                    <td style="width: 100px; height: 26px;">                        Email</td>                    <td style="width: 100px; height: 26px;">                        <asp:TextBox ID="TextBox3" runat="server"></asp:TextBox></td>                </tr>            </table>        </div>        </div>        <div style="text-align: center">            <div>                <div>                    <asp:ScriptManager ID="ScripManager1" runat="server">                    </asp:ScriptManager>                    <div>                        <table>                            <tr>                                <td style="width: 100px">                        Group</td>                                <td style="width: 100px">                                   
<asp:DropDownList ID="ddl1" runat="server" AutoPostBack="true"
OnSelectedIndexChanged="ddl1_SelectedIndexChanged">                                    </asp:DropDownList></td>                            </tr>                        </table>                        &nbsp;</div>                    <div>                        <asp:UpdatePanel ID="UpdatePanel1" runat="server">                            <ContentTemplate>                                <table>                                    <tr>                                        <td>                        Organisation&nbsp;</td>                                        <td>                                           
<asp:DropDownList ID="ddl2" runat="server" AutoPostBack="true"
OnSelectedIndexChanged="ddl2_SelectedIndexChanged">                                            </asp:DropDownList>&nbsp;                                        </td>                                    </tr>                                    <tr>                                        <td>                        org-phone&nbsp;</td>                                        <td>                        <asp:TextBox ID="TextBox4" runat="server"></asp:TextBox>&nbsp;</td>                                    </tr>                                    <tr>                                        <td>                                        </td>                                        <td>                                           
<asp:TextBox ID="TextBox5" runat="server"
Width="45px"></asp:TextBox></td>                                    </tr>                                </table>                            </ContentTemplate>                            <Triggers>                                <asp:AsyncPostBackTrigger ControlID="ddl1" EventName="SelectedIndexChanged" />                            </Triggers>                        </asp:UpdatePanel>                        <br />                        <table>                            <tr>                                <td style="width: 100px">                        <asp:Button ID="Button1" runat="server" Text="save" OnClick="Button1_Click" />                                </td>                                <td style="width: 100px">                                    <asp:Button ID="Button3" runat="server" Text="update" /></td>                                <td style="width: 100px">                        <asp:Button ID="Button2" runat="server" Text="cancel" /></td>                            </tr>                        </table>                    </div>                </div>            </div>        </div>    </form></body></html>userform.cs page public partial class userform : System.Web.UI.Page{    protected void Page_Load(object sender, EventArgs e)    {        if (!Page.IsPostBack)        {            AssignDDLDataSource();            ddl1_SelectedIndexChanged(null, null);        }    }        private void AssignDDLDataSource()    {                // SqlConnection             string sqlQry = "SELECT GRP DISPMEM, ID VALMEM FROM GRUP";        SqlCommand cmd = new SqlCommand(sqlQry, con);        ddl1.DataSource = cmd.ExecuteReader();        ddl1.DataTextField = "DISPMEM";        ddl1.DataValueField = "VALMEM";        ddl1.DataBind();    }    protected void ddl1_SelectedIndexChanged(object sender, EventArgs e)    {        AssignSubjectDDL(ddl1.SelectedValue);    }    private void AssignSubjectDDL(string val)    {       // SqlConnection        string sqlQry = "SELECT ORGANISATION DISPMEM, GID VALMEM FROM ORGANIZATION where OID = '" + val + "'";        SqlCommand cmd1 = new SqlCommand(sqlQry, con);        ddl2.DataSource = cmd1.ExecuteReader();        ddl2.DataTextField = "DISPMEM";        ddl2.DataValueField = "VALMEM";        ddl2.DataBind();        ddl2_SelectedIndexChanged(null, null);    }    protected void ddl2_SelectedIndexChanged(object sender, EventArgs e)    {        AssignTextBoxValues(ddl1.SelectedValue, ddl2.SelectedValue);    }    private void AssignTextBoxValues(string teamval, string memval)    {         // SqlConnection       
string sqlQry = "Select ID,ORGANISATION,ORGPHONE from ORGANIZATION
where OID = '" + teamval + "' AND GID = '" + memval + "'";        SqlCommand cmd = new SqlCommand(sqlQry, con);        SqlDataReader rdr = cmd.ExecuteReader();        while (rdr.Read())        {            TextBox5.Text = rdr["ID"].ToString().Trim();            TextBox4.Text = rdr["ORGPHONE"].ToString().Trim();        }    }    protected void Button1_Click(object sender, EventArgs e)    {       // SqlConnection       
string sqlQry = "INSERT into USERFORM (title, name, address, email,
organizationid) VALUES(@title,@name,@address,@email,@organizationid)";        SqlCommand cmd = new SqlCommand(sqlQry, con);        cmd.CommandType = CommandType.Text;        cmd.Parameters.AddWithValue("title", DropDownList1.SelectedValue.Trim());        cmd.Parameters.AddWithValue("name", TextBox1.Text);        cmd.Parameters.AddWithValue("address", TextBox2.Text);        cmd.Parameters.AddWithValue("email", TextBox3.Text);        cmd.Parameters.AddWithValue("organizationid", TextBox5.Text);        cmd.ExecuteNonQuery();        Response.Redirect("detailsview.aspx");    }} detailsview.aspx <%@ Page Language="C#" AutoEventWireup="true" CodeFile="detailsview.aspx.cs" Inherits="detailsview" %><!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></head><body>    <form id="form1" runat="server">    <div>        <asp:DetailsView ID="DetailsView1" runat="server" AllowPaging="True" EnablePagingCallbacks="True"            Height="50px" HorizontalAlign="Center" Width="125px">        </asp:DetailsView>        </div>    </form></body></html> detailsview.cspublic partial class detailsview : System.Web.UI.Page{    protected void Page_Load(object sender, EventArgs e)    {        //SqlConnection        
string str = "select title,name,address,email,grp,organisation,orgphone
from userform as a inner join organization as b on
a.organizationid=b.id inner join grup as c on b.oid=c.id";        SqlDataAdapter oda = new SqlDataAdapter(str, conn);        conn.Open();        DataSet ods = new DataSet();        oda.Fill(ods, "info");        DetailsView1.DataSource = ods.Tables["info"].DefaultView;        DetailsView1.DataBind();              }}My problem :-Now when user fills up the userform and clicks the save button the details are shown in the details view.Now i want to add a Edit hyperlink next to the records in the detailsview so that when i click on it i would be redirected to userform.aspx form with all the textboxes,dropdownlist etc be populated from the related data from the database.(here table userform).Now i want to edit these data in the userform.aspx page and finally when i click the update button at end i want all the data be updated in the database aswell as in details view too.at the same time i want this form to redirect to detailsview.aspx .i hope ur getting it?i m able to do partial part only.Not completely. So can u now  help me modify the code accordingly?Thanks in advance.Jack.  

View 4 Replies View Related

Insert Information And To Database And Retrieve The ID Created For That Row Of Data In The Table

May 4, 2007

Hi,
 I am working on inserting information into a DB and then retrieving the ID created for that Data to use elsewhere in my code. I have the code below but I do not know how to get toOutput parameter. Can anyone please help?
  
CREATE PROCEDURE dbo.InsertProduction
@DATEOUT datetime(8),
@DATEREQUIRED datetime(8),
@PREPAREDBY varchar,
@COMMENTID INteger,
@TOTALQUANTITY INteger,
@VENDORID INteger,
@WPO varchar,
@TCAPONUMBER INteger,
@APPROVEDBY varchar,
@Identity int OUT
 
AS
INSERT INTO PRODUCTION (DATEOUT,DATEREQUIRED, PREPAREDBY, COMMENTID, TOTALQUANTITY, VENDORID, WPO, TCAPONUMBER, APPROVEDBY) VALUES( @DATEOUT, @DATEREQUIRED, @PREPAREDBY, @COMMENTID, @TOTALQUANTITY, @VENDORID, @WPO, @TCAPONUMBER, @APPROVEDBY)
SET @Identity = SCOPE_IDENTITY()
 
 
'collect all the information from the form and then apply all and then update
'Get a reference to the Production table.
Dim dtProduction As DataTable = DS.Tables("Production")
Dim dtLineItem As DataTable = DS.Tables("LineItems")
' Create the SqlCommand to execute the stored procedure.
Production.InsertCommand = New SqlCommand("dbo.InsertProduction", connection)
Production.InsertCommand.CommandType = CommandType.StoredProcedure
' Add the parameter for the CategoryName. Specifying the
' ParameterDirection for an input parameter is not required.
'Production.InsertCommand.Parameters.Add("@CategoryName", SqlDbType.NVarChar, 15, "CategoryName")
Production.InsertCommand.Parameters.Add("@DATEOUT", SqlDbType.DateTime, 8, "CategoryName")
Production.InsertCommand.Parameters.Add("@DATEREQUIRED", SqlDbType.DateTime, 8, "CategoryName")
Production.InsertCommand.Parameters.Add("@PREPAREDBY", SqlDbType.VarChar, 50, "CategoryName")
Production.InsertCommand.Parameters.Add("@COMMENTID", SqlDbType.Int, 4, "CategoryName")
Production.InsertCommand.Parameters.Add("@TOTALQUANTITY", SqlDbType.Int, 4, "CategoryName")
Production.InsertCommand.Parameters.Add("@VENDORID", SqlDbType.Int, 4, "CategoryName")
Production.InsertCommand.Parameters.Add("@WPO", SqlDbType.VarChar, 50, "CategoryName")
Production.InsertCommand.Parameters.Add("@TCAPONUMBER", SqlDbType.Int, 4, "CategoryName")
Production.InsertCommand.Parameters.Add("@APPROVEDBY", SqlDbType.VarChar, 50, "CategoryName")
' Add the SqlParameter to retrieve the new identity value.
' Specify the ParameterDirection as Output.
Dim parameter As SqlParameter = Production.InsertCommand.Parameters.Add("@Identity", SqlDbType.Int, 0, "ProductionID")
parameter.Direction = ParameterDirection.Output
' Create a new row with the same schema.
Dim dr As DataRow = dtProduction.NewRow()
'you need the ID from this to insert into the Production DB
' Set the value of all the columns.
dr("DateOut") = CDate(DateTimePicker1.Text)
dr("DateRequired") = CDate(DateTimePicker2.Text)
dr("VendorID") = CInt(vendorbox.SelectedValue)
dr("HomeAddress") = txtApproved.Text.ToString
dr("ApprovedBy") = txtPrepared.Text.ToString
dr("TCAPO") = CInt(txtTCAPO.Text.Trim)
dr("CommentID") = CommentID
dr("TotalCost") = CDec(txtTotals.Text)
dr("TotalQuantity") = CInt(txtQtyTotal.Text)
' Add to the Rows collection or table .
dtProduction.Rows.Add(dr)
'Update the Production Table and then retrieve the ID created in this case
Production.Update(dtProduction)
 
 
Dollarjunkie

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

Creating A View To Retrieve Data From More Than One Database Sql Server 2000

Jul 26, 2007

Hi everyone,


we have some reference tables in in a specific database. that other applications need to have access to them. Is it possible to create a view in the application's database to retrive data from ref database while users just have access to the application Database not the view's underlying tables?

Thanks

View 1 Replies View Related

Data Access :: How To Retrieve Remote Database Table Value To String Variable

May 28, 2015

I am using C# in  Visual Studio 2008 and remote database as sql server 2008 R2. I want to read remote database table's field value and i have to move that read value to string variable. how to do it. 

And my code is :

string sql = "Select fldinput from tmessage_temp where fldTo=IDENT_CURRENT('tmessage_temp')";
SqlCommand exesql = new SqlCommand(sql, cn);
exesql.CommandType = CommandType.Text;
SqlDataReader rd1 = default(SqlDataReader);
rd1 = exesql.ExecuteReader();

View 6 Replies View Related

Reporting Services :: Map Parameter In Report Builder 3.0 Into Query To Retrieve Data From Database

May 29, 2015

Currently, I want to get images of an item in my report for illustration purpose.

Below is my query to get image for item 'GL-10000' in the database. However, I would like to pass a parameter value, '@sItem', from my report so that it would get all related pics of items.  

SQL Query:

Select top 1 item_picture_mst.picture from item_picture_mst
where item_picture_mst.item in (select item_all.item from item_all where item_all.item = 'GL-10000')
ORDER BY item_picture_mst.picture DESC;

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

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

How Can I Retrieve A Pdf File From The Database?

Nov 9, 2006

i'm working with a project right now that needs pdf file retrieval from the database with the use of a search engine... any codes that could make that search engine to function properly? and make it work?

View 1 Replies View Related

Retrieve Database Image By 2 Ids

Feb 28, 2008

Hi, I'm stuck trying to figure out how to call an image from the database by certain ids.  I want to get it like this: page.aspx?pictureid=#&userid=#
here's the show.aspx:Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim PictureID As Integer = Convert.ToInt32(Request.QueryString("ppID"))Dim MemberID As Integer = Convert.ToInt32(Request.QueryString("mID"))
'Connect to the database and bring back the image contents & MIME type for the specified pictureUsing myConnection As New SqlConnection(ConfigurationManager.ConnectionStrings("objConn").ConnectionString)
Const SQL As String = "SELECT [ppMIMEType], [ppImageData] FROM [tblPP] WHERE ([ppID] = @ppID) & ("[mID] = @mID)"Dim myCommand As New SqlCommand(SQL, myConnection)
myCommand.Parameters.AddWithValue("@ppID", PictureID)
myCommand.Parameters.AddWithValue("@mID", MemberID)
myConnection.Open()Dim myReader As SqlDataReader = myCommand.ExecuteReader
If myReader.Read ThenResponse.ContentType = myReader("ppMIMEType").ToString()
Response.BinaryWrite(myReader("ppImageData"))
End If
myReader.Close()
myConnection.Close()
End Using
End Sub
 here's the formview to display image with datasource:
<asp:FormView ID="PictureUI" runat="server" DataKeyNames="ppID,mID" DataSourceID="PicturesDataSource" AllowPaging="False" EmptyDataText="There are currently no pictures uploaded" HorizontalAlign="Center" CellPadding="0">
<ItemTemplate>
<asp:Image ID="Image1" runat="server" ImageUrl='<%# Eval("ppID", "~/Show.aspx?ppID=" & 1 &"mID=" & 1 &"") %>' />
 
</ItemTemplate>
 
</asp:FormView>
 
<asp:SqlDataSource ID="PicturesDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:Connect %>"
SelectCommand="SELECT [ppID], [ppDateTime], [mID] FROM [tblPP] ORDER BY [ppDateTime]">
</asp:SqlDataSource>

View 3 Replies View Related

How To Retrieve Resume From Database

Mar 20, 2008

I stored resume in database with datatype Image. But now i want to retrieve the resume becoz if user wants to edit their resume and again i shud store the updated resume into my database.
Give me ideas...Thanks in adv!! 
 

View 4 Replies View Related

How Do I Retrieve The Available Tables In A Database

Sep 20, 2004

I need to retrieve the available tables in a database in SQL Server 2000. I found this command and although it works I can't figure out how to filter the results.

exec sp_tables

I don't want to return the whole list, just the tables starting with "OV" and "SV". Does SQL Server 2000 support a wildcard? Like can I have it search for "OV*" or do I have to use LIKE. Did google search with no helpful results. I remember in mySQL this was simply "SHOW Tables" but this command isn't supported in SQL Server 2000.

any help would be appreciated

thanks

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

Right Way To Retrieve Data From Sql-server

Mar 19, 2007

Last night I face performace problems in web site. I got like 100 000 users and site fails because of sql-connections.
Currently I'm making a new connection for every query, and my code looks like this:Public Shared Function executeQueryReturnDataset(ByVal strsql As String) As DataSet
Dim sqlConnection As New SqlConnection(Connstr)
Dim sqlCommand As New SqlCommand(strsql, sqlConnection)
Dim sqlDataSet As New DataSet

Try
sqlConnection.Open()
Dim myDataAdapter As New SqlDataAdapter
myDataAdapter.SelectCommand = sqlCommand
myDataAdapter.Fill(sqlDataSet)
Catch e As Exception
Console.Write(e.ToString())
Finally
sqlConnection.Close()
End Try
Return sqlDataSet
End Function I was wondering would it be better to save an instance from connection object to memory and use that same connection for all querys?

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

I Can't Retrieve Data After Inserting It ?

Mar 1, 2008

Dears,
I'm using FormView to insert and retrieve data from SQL Server Database 2000. I'm using stored procedure to insert and display data by using C#.
Every time I insert the data, I can't retrive it. To retrieve all the inserted data, I have to close my website, and then reopen it again.
I close the connection every time after using the stored procedures, but nothing happened.
What do you think the problem is ??
 

View 3 Replies View Related

How To Retrieve Data From SQL Server?

Mar 14, 2006

Let us suppose that there are 900 rows in One table, and that table contains neither primary key, nor Identity column.
How can I retrieve all the roows from 201 to 250?(like the middle limits)
In oracle there is a property called RowID, but is there any such item in SQL server?

View 1 Replies View Related

How Do I Retrieve Sql Data In A Distinct-like Way?

Jul 23, 2007

I wonder how to get top 1 row per account number. Let's say I have

--snip--
IDENTITY_ID | ACCT_NUMBER
0001 | 1111-2222
1001 | 1111-2222
2002 | 2222-0000
3003 | 2222-0000
4004 | 1111-2222
--snip--

I used the SQL-Query here


Code:


SELECT * FROM BACKUP_LOG ORDER BY IDENTITY_ID DESC
[code]

Since they are in descending order by IDENTITY_ID, so I only want to get 1 distinct account number somehow.. Like this...

[code]
4004 | 1111-2222
3003 | 2222-0000



I couldn't figure it out.

Thanks...

View 9 Replies View Related

How To Retrieve Data Randomly?

Jul 21, 2004

I have a table called Questions and I need to retrieve 10 rows of data randomly each time. If I use

SELECT TOP 10 Question FROM Questions

I'll get the same questions each time when I execute the sql statement. Is there a way to get the random data? Thanks.

View 1 Replies View Related

How To Retrieve Data Using A Search?

Feb 20, 2005

Hello
Is there any way in which i can retirve data using input parameters?

View 14 Replies View Related

Query To Retrieve Data From XML

Sep 9, 2014

Here is the sample xml

<ClinicalDocument xmlns:sdtc="urn:h12-org:abcd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:h12-org:v3">
<realmCode code="US" />
<typeId extension="POCD_HD000040" root="2.16.840.1.113883.1.3" />
<templateId root="2.16.840.1.113883.10.20.22.1.1" />
<id root="226ff30f-3b1f-11e3-a969-005056bb0109" />

[code]....

how to write a sql query.

View 2 Replies View Related







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