1. Using DataRelation in DataSet

    Date: 05/28/10     Keywords: sql

    Hi everybody!
    This is the question about how to use DataRelation object.
    Let's say I have 2 tables:
    SELECT customerId, customerName FROM customers
    and
    SELECT orderId, customerId, orderName FROM orders
    which are related by customerId.

    Assume I have method

    getDataSet(sqlTextArray)

    which returns me the DataSet based on array of queries sqlTextArray

    So, then I can write:

    String q1 = 
       "SELECT c.customerName, r.orderId, r.orderName "+
       "FROM customers AS c, orders as r "+
       "WHERE (c.ustomerId = r.customerId) ";
    String[] q = new String[] { q1 };
    
    DataSet d = getDataSet(q);
    DataTable t = d.Tables[0];
    for (int i=0; i < t.Rows.Count; i++) {
       String s = t.Rows[i]["customerName"] + ", " + 
          t.Rows[i]["orderId"] + ", " + t.Rows[i]["orderName"] + ".";
       Console.WriteLine(s);
    }
    

    This part is clear for me. Then, I want to achieve the same result by using
    DataRelation. In this case I should write something like this:
    String[] q = new String[] { 
       "SELECT customerId, customerName FROM customers", 
       "SELECT orderId, customerId, orderName FROM orders" 
    };
    DataSet d = getDataSet(q);
    d.Relations.Add(new DataRelation("customer2order",
       d.Tables[0].Columns["customerId"],
       d.Tables[1].Columns["customerId"]));
    

    How to print out the combined data as I did that in first example?

    Source: http://aspdotnet.livejournal.com/104432.html

  2. Using DataRelation in DataSet

    Date: 05/28/10     Keywords: sql

    Hi everybody!
    This is the question about how to use DataRelation object.
    Let's say I have 2 tables:
    SELECT customerId, customerName FROM customers
    and
    SELECT orderId, customerId, orderName FROM orders
    which are related by customerId.

    Assume I have method

    getDataSet(sqlTextArray)

    which returns me the DataSet based on array of queries sqlTextArray

    So, then I can write:

    String q1 = 
       "SELECT c.customerName, r.orderId, r.orderName "+
       "FROM customers AS c, orders as r "+
       "WHERE (c.ustomerId = r.customerId) ";
    String[] q = new String[] { q1 };
    
    DataSet d = getDataSet(q);
    DataTable t = d.Tables[0];
    for (int i=0; i < t.Rows.Count; i++) {
       String s = t.Rows[i]["customerName"] + ", " + 
          t.Rows[i]["orderId"] + ", " + t.Rows[i]["orderName"] + ".";
       Console.WriteLine(s);
    }
    

    This part is clear for me. Then, I want to achieve the same result by using
    DataRelation. In this case I should write something like this:
    String[] q = new String[] { 
       "SELECT customerId, customerName FROM customers", 
       "SELECT orderId, customerId, orderName FROM orders" 
    };
    DataSet d = getDataSet(q);
    d.Relations.Add(new DataRelation("customer2order",
       d.Tables[0].Columns["customerId"],
       d.Tables[1].Columns["customerId"]));
    

    How to print out the combined data as I did that in first example?

    Source: https://aspdotnet.livejournal.com/104432.html

  3. Converting Date in SQL Server

    Date: 10/30/09     Keywords: database

    I've been looking around everywhere, but either don't know how to search for it or don't know what I'm looking at... but I'm trying to convert dates that I pull from a database from 30/10/2009 00:00:00AM or whatever it comes up as to just the date. I found a convert statement, but have no idea where to put it in my select statement (or if it goes somewhere else).

    I tried
    SELECT ID, title, caption, credit, date (CONVERT(VARCHAR(8), GETDATE(), 1) AS [MM/DD/YY]) FROM MMphotos WHERE (ID = @ID)

    and
    SELECT * FROM MMphotos WHERE (ID = @ID) CONVERT(VARCHAR(8), GETDATE(), 1) AS [MM/DD/YY]

    But neither worked... but both returned different errors. First one is saying "'date' is not a recognized built-in function name" and the second was saying "Incorrect syntax near the keyword 'CONVERT'"

    What am I mucking up?

    Source: http://aspdotnet.livejournal.com/103632.html

  4. Converting Date in SQL Server

    Date: 10/30/09     Keywords: database

    I've been looking around everywhere, but either don't know how to search for it or don't know what I'm looking at... but I'm trying to convert dates that I pull from a database from 30/10/2009 00:00:00AM or whatever it comes up as to just the date. I found a convert statement, but have no idea where to put it in my select statement (or if it goes somewhere else).

    I tried
    SELECT ID, title, caption, credit, date (CONVERT(VARCHAR(8), GETDATE(), 1) AS [MM/DD/YY]) FROM MMphotos WHERE (ID = @ID)

    and
    SELECT * FROM MMphotos WHERE (ID = @ID) CONVERT(VARCHAR(8), GETDATE(), 1) AS [MM/DD/YY]

    But neither worked... but both returned different errors. First one is saying "'date' is not a recognized built-in function name" and the second was saying "Incorrect syntax near the keyword 'CONVERT'"

    What am I mucking up?

    Source: https://aspdotnet.livejournal.com/103632.html

  5. Подготовка к сертификации Microsoft

    Date: 04/01/09     Keywords: web, microsoft



    Приглашаю в Study Group для подготовки к сертификации Microsoft.

    Подробности про Study Group

    Цель группы:
    Подготовиться к сдаче программерских сертификатов Microsoft. Начнем со сдачи экзаменов по net (Web разработка).

    Когда начнем работать?
    Работать начнем через две недели. Задачи на эти 2 недели: составить программу курса, разработать план обучения и сдачи экзаменов. Так что присылайте ссылки на книги и др. информацию, которую хотите изучить мне (ведущему группы) скайп или в ЖЖ ivinsky.

    Как часто планируется проводить встречи?
    Основная задача группы: получение сертификатов Microsoft в кратчайшие сроки, поэтому встречи будут проводиться 5 дней в неделю по вечерам, время уточним позже. Если Вы хотите стать сертифицированным специалистам Microsoft в кратчайшие сроки, то это группа для Вас. Присоединяйтесь!

    Source: http://aspdotnet.livejournal.com/103280.html

  6. Подготовка к сертификации Microsoft

    Date: 04/01/09     Keywords: web, microsoft



    Приглашаю в Study Group для подготовки к сертификации Microsoft.

    Подробности про Study Group

    Цель группы:
    Подготовиться к сдаче программерских сертификатов Microsoft. Начнем со сдачи экзаменов по net (Web разработка).

    Когда начнем работать?
    Работать начнем через две недели. Задачи на эти 2 недели: составить программу курса, разработать план обучения и сдачи экзаменов. Так что присылайте ссылки на книги и др. информацию, которую хотите изучить мне (ведущему группы) скайп или в ЖЖ ivinsky.

    Как часто планируется проводить встречи?
    Основная задача группы: получение сертификатов Microsoft в кратчайшие сроки, поэтому встречи будут проводиться 5 дней в неделю по вечерам, время уточним позже. Если Вы хотите стать сертифицированным специалистам Microsoft в кратчайшие сроки, то это группа для Вас. Присоединяйтесь!

    Source: https://aspdotnet.livejournal.com/103280.html

  7. Drag and Drop Listbox

    Date: 02/17/09     Keywords: database, asp, sql, web

    Hi,
    What I am trying to do this time is create an asp.net listbox from
    an SQL Server 2005 result set (done) which then users can sort the
    records to form the running order within the same Listbox and then
    submit all the records including the new running order back into
    the database. Each record has already been automatically assigned
    a running order number based on their position in the old website.

    I am looking for suggestions on the quickest and *easist* way to do
    this, examples would be much appreciated. My web application is asp.net
    written in C#.

    Any help is appreciated.

    Source: http://community.livejournal.com/aspdotnet/103147.html

  8. Drag and Drop Listbox

    Date: 02/17/09     Keywords: database, asp, sql, web

    Hi,
    What I am trying to do this time is create an asp.net listbox from
    an SQL Server 2005 result set (done) which then users can sort the
    records to form the running order within the same Listbox and then
    submit all the records including the new running order back into
    the database. Each record has already been automatically assigned
    a running order number based on their position in the old website.

    I am looking for suggestions on the quickest and *easist* way to do
    this, examples would be much appreciated. My web application is asp.net
    written in C#.

    Any help is appreciated.

    Source: http://aspdotnet.livejournal.com/103147.html

  9. Drag and Drop Listbox

    Date: 02/17/09     Keywords: database, asp, sql, web

    Hi,
    What I am trying to do this time is create an asp.net listbox from
    an SQL Server 2005 result set (done) which then users can sort the
    records to form the running order within the same Listbox and then
    submit all the records including the new running order back into
    the database. Each record has already been automatically assigned
    a running order number based on their position in the old website.

    I am looking for suggestions on the quickest and *easist* way to do
    this, examples would be much appreciated. My web application is asp.net
    written in C#.

    Any help is appreciated.

    Source: https://aspdotnet.livejournal.com/103147.html

  10. Saving Files from a Website using VB.Net

    Date: 01/28/09     Keywords: html, database, web

    I have a site that we are moving from Flat HTML into a Database using in house
    written VB.Net applications. The website is roughly 10,000 pages. The volume of
    pages however is not the problem. The Page HTML content is all now held in a
    database, Now I am looping through the pages and checking each page using regular
    expressions for either a href or img src tag so I can collect the URL for all
    images and attachments. Once I have these, i pass the URL (currently) to the
    HttpWebRequest.DownloadData which makes a request to the website for the url
    provided and then the attachment is downloaded and eventually written out using
    the WriteAllBytes() function. This works for one iterration and then times out.
    What i need to know is why does it time out and is there a better method of doing
    this? the files can be rather large that are getting moved the site is about 5.7gb
    and most of this will be down to diffrent file formats.

    Source: http://community.livejournal.com/aspdotnet/102801.html

  11. Saving Files from a Website using VB.Net

    Date: 01/28/09     Keywords: html, database, web

    I have a site that we are moving from Flat HTML into a Database using in house
    written VB.Net applications. The website is roughly 10,000 pages. The volume of
    pages however is not the problem. The Page HTML content is all now held in a
    database, Now I am looping through the pages and checking each page using regular
    expressions for either a href or img src tag so I can collect the URL for all
    images and attachments. Once I have these, i pass the URL (currently) to the
    HttpWebRequest.DownloadData which makes a request to the website for the url
    provided and then the attachment is downloaded and eventually written out using
    the WriteAllBytes() function. This works for one iterration and then times out.
    What i need to know is why does it time out and is there a better method of doing
    this? the files can be rather large that are getting moved the site is about 5.7gb
    and most of this will be down to diffrent file formats.

    Source: http://aspdotnet.livejournal.com/102801.html

  12. Saving Files from a Website using VB.Net

    Date: 01/28/09     Keywords: html, database, web

    I have a site that we are moving from Flat HTML into a Database using in house
    written VB.Net applications. The website is roughly 10,000 pages. The volume of
    pages however is not the problem. The Page HTML content is all now held in a
    database, Now I am looping through the pages and checking each page using regular
    expressions for either a href or img src tag so I can collect the URL for all
    images and attachments. Once I have these, i pass the URL (currently) to the
    HttpWebRequest.DownloadData which makes a request to the website for the url
    provided and then the attachment is downloaded and eventually written out using
    the WriteAllBytes() function. This works for one iterration and then times out.
    What i need to know is why does it time out and is there a better method of doing
    this? the files can be rather large that are getting moved the site is about 5.7gb
    and most of this will be down to diffrent file formats.

    Source: https://aspdotnet.livejournal.com/102801.html

  13. Separator lines in asp:menu control

    Date: 01/05/09     Keywords: asp

    I need separator lines in the dynamic menu section of an asp:menu control.

    However, I only want separator lines between certain menu items - not all of them.

    Is that possible ?

    Source: http://community.livejournal.com/aspdotnet/102432.html

  14. Separator lines in asp:menu control

    Date: 01/05/09     Keywords: asp

    I need separator lines in the dynamic menu section of an asp:menu control.

    However, I only want separator lines between certain menu items - not all of them.

    Is that possible ?

    Source: http://aspdotnet.livejournal.com/102432.html

  15. Separator lines in asp:menu control

    Date: 01/05/09     Keywords: asp

    I need separator lines in the dynamic menu section of an asp:menu control.

    However, I only want separator lines between certain menu items - not all of them.

    Is that possible ?

    Source: https://aspdotnet.livejournal.com/102432.html

  16. update form

    Date: 11/28/08     Keywords: database

    I'm trying to create an item update page for a product database, and was wondering if there's something similar to

    ConnectionString="server=...;database=...;uid=...;pwd=..."
    SelectCommand="SELECT * FROM database WHERE (ID = @ID)" >

    DefaultValue="%" />


    for updating and inserting? I use code like that for search queries, and tried changing "select" to "update" in the code to see if that might work, but no luck. I want there to be a 1st page where you select the product to be updated, then that brings you to a form that has all the product info inserted into the form (with the ID disabled), then you can edit and after submitting, it goes to the 3rd page that gives the success message and updates the table. I have the fist two pages working fine, the form populated with the right data, but after hitting submit, I don't get an error regarding the coding, but no data is updated. I tried using the datagrid method on the MSDN site, because it has worked for inserting new data, but, besides also being kinda bulky to use, it didn't work either. Any suggestions?

    Source: http://community.livejournal.com/aspdotnet/102205.html

  17. update form

    Date: 11/28/08     Keywords: database

    I'm trying to create an item update page for a product database, and was wondering if there's something similar to

    ConnectionString="server=...;database=...;uid=...;pwd=..."
    SelectCommand="SELECT * FROM database WHERE (ID = @ID)" >

    DefaultValue="%" />


    for updating and inserting? I use code like that for search queries, and tried changing "select" to "update" in the code to see if that might work, but no luck. I want there to be a 1st page where you select the product to be updated, then that brings you to a form that has all the product info inserted into the form (with the ID disabled), then you can edit and after submitting, it goes to the 3rd page that gives the success message and updates the table. I have the fist two pages working fine, the form populated with the right data, but after hitting submit, I don't get an error regarding the coding, but no data is updated. I tried using the datagrid method on the MSDN site, because it has worked for inserting new data, but, besides also being kinda bulky to use, it didn't work either. Any suggestions?

    Source: http://aspdotnet.livejournal.com/102205.html

  18. update form

    Date: 11/28/08     Keywords: database

    I'm trying to create an item update page for a product database, and was wondering if there's something similar to

    ConnectionString="server=...;database=...;uid=...;pwd=..."
    SelectCommand="SELECT * FROM database WHERE (ID = @ID)" >

    DefaultValue="%" />


    for updating and inserting? I use code like that for search queries, and tried changing "select" to "update" in the code to see if that might work, but no luck. I want there to be a 1st page where you select the product to be updated, then that brings you to a form that has all the product info inserted into the form (with the ID disabled), then you can edit and after submitting, it goes to the 3rd page that gives the success message and updates the table. I have the fist two pages working fine, the form populated with the right data, but after hitting submit, I don't get an error regarding the coding, but no data is updated. I tried using the datagrid method on the MSDN site, because it has worked for inserting new data, but, besides also being kinda bulky to use, it didn't work either. Any suggestions?

    Source: https://aspdotnet.livejournal.com/102205.html

  19. Access the XSD file, Computer says no!

    Date: 11/28/08     Keywords: database, sql

    I keep getting an error the error 1) in my code, I am using a xsd file to call stored procedure and
    access the database. This worked fine under Windows 2000 using visual basic express 2005. I am now
    on a XP Machine using VS 2005 and i can get it to work. The error occurs at this point 2) and the
    code that defines that dataaccess is listed as 3). So what am i doing wrong then all suggestion
    accepted.

    1) Request for the permission of type 'System.Data.SqlClient.SqlClientPermission, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

    2) content_page = dataaccess.GetContentPages()

    3)

    Dim content_page As Object
    Dim page As Object
    Dim page_number As Integer
    Dim page_content As String

    ' call out the pages from the database
    Dim dataaccess As DataSet1TableAdapters.pagesTableAdapter = New DataSet1TableAdapters.pagesTableAdapter
    content_page = dataaccess.GetContentPages()

    ' Loop through the record set
    For Each page In content_page
    ' assigned the page and content values to variables
    page_number = page
    page_content = page

    Source: http://community.livejournal.com/aspdotnet/101914.html

  20. Access the XSD file, Computer says no!

    Date: 11/28/08     Keywords: database, sql

    I keep getting an error the error 1) in my code, I am using a xsd file to call stored procedure and
    access the database. This worked fine under Windows 2000 using visual basic express 2005. I am now
    on a XP Machine using VS 2005 and i can get it to work. The error occurs at this point 2) and the
    code that defines that dataaccess is listed as 3). So what am i doing wrong then all suggestion
    accepted.

    1) Request for the permission of type 'System.Data.SqlClient.SqlClientPermission, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

    2) content_page = dataaccess.GetContentPages()

    3)

    Dim content_page As Object
    Dim page As Object
    Dim page_number As Integer
    Dim page_content As String

    ' call out the pages from the database
    Dim dataaccess As DataSet1TableAdapters.pagesTableAdapter = New DataSet1TableAdapters.pagesTableAdapter
    content_page = dataaccess.GetContentPages()

    ' Loop through the record set
    For Each page In content_page
    ' assigned the page and content values to variables
    page_number = page
    page_content = page

    Source: http://aspdotnet.livejournal.com/101914.html

  ||  Next page


antivirus | apache | asp | blogging | browser | bugtracking | cms | crm | css | database | ebay | ecommerce | google | hosting | html | java | jsp | linux | microsoft | mysql | offshore | offshoring | oscommerce | php | postgresql | programming | rss | security | seo | shopping | software | spam | spyware | sql | technology | templates | tracker | virus | web | xml | yahoo | home