Latest developer linksBookmark and Share
 
HomeThis WeekTop MonthTop AlltimeSearchRegisterFAQ
  
 
Submit Your Link
Please login to submit your Link
 

From an Access 2007 Front-End, can I get the SQL View to use a different table?

Posted: Jan/22/2011   By: nikhil   Points:15   Category: .NET  - ASP.Net    Views:89   Vote Up (0)   Vote Down (0)    

First off, I'm new to SQL Server.  I'm working with my first database.

I do have ownership of the SQL database and so far have added users, created tables, roles (and assigned users to the roles), and views (and given roles permissions to the views).

The database has a number of tables with names like: History_1, History_2, ...

One View's SQL statement includes:

              From dbo.History_1 as H

              Where (H.Subdivision = '300_03')

If the user is assigned to a role that has permission to the view, I would like to be able to change the table used in the view (perhaps a pass-through parameter?) by selecting the desired table name from a combo or list box in the Access 2007 front end .mdb file.

Or do I have to create a separate view for each of the tables in the SQL Server database?

Any help would be appreciated.

View Complete Post


Comments:
Be the first to comment this post.
 
Post Comment
Please login to post your comment
More Related Resources

how to put jquery quicksearch in a table cell

  

I am learning ASP and C#, but as yet no nothing about java....I am utilising jquery quicksearch on a GridView, and have it working fine, but there are two things I would like to know :-

1 - I have a table with 1 row and 3 columns.  How can I put the quicksearch box in the first column ?

2 - How can I change the font or apply a CSS style to the text "Search" ?

Here is the code I am using...

<script type="text/javascript" >
       $(document).ready(
        function () {
            $('table#<%=gvContacts.ClientID %> tbody tr  ').quicksearch({
                position: 'before',
                attached: 'table#<%=gvContacts.ClientID %>',
                stripeRowClass: ['odd', 'even'],
                labelText: 'Search:',              
                delay: 100,
                loaderText: 'Loading...',
                
                }

            });
        });
        $(document).ready(
        function () {
            $("#<%=gvContacts.ClientID %>").tablesorter();
            $("#options").tablesorter({ sortList: [[0, 0]], headers: { 3: { sorter: false }, 4: { sorter: false}} });

        });

       
        </script>


Thank you in advance



cannot add a new column-Unable to modify table.Invalid object name 'MSED_Logs.DatabaseLog'

  

Dear All,

I cannot add a new column in existing table.

I have a two tables ['ev_event_how' & 'ev_events_event_how'] has relationship between these table.

Ex:
Table: 'ev_event_how'

UID - Event[PK]

 

Ex:
Table: 'ev_events_event_how'

UID - Event[FK] - Desc

I want to add a one more column[IsDelete] in both table. But Sql server is not allowing to add the new column, Showing various errors like

1.cannot add a new column-Unable to modify table.Invalid object name 'MSED_Logs.DatabaseLog'

2.TITLE: Microsoft SQL Server Management Studio
------------------------------

User canceled out of save dialog
 (MS Visual Database Tools)

 

How can I make it add a new column in existing table?

 

 

 

 

 

 

 


In VB.Net - how to login on a website and access another page maintaining the session

  

Have a project where I need to access a RSS feed.   The issue is this RSS feed, you need to be logged in as a user.   They have a simple web form (login + password).   How do I?

1) Post a web form with my login and password

2) Maintaining Session (w/successful login), do an additiional GET to retrieve the RSS feed.

I am doing this in an ASP.Net page so it all happens server side in VB.Net

Brian 


grid view without any data source date sorting problem

  

i grid view contain the following coloum

id    name         DateofBirth                  DateofJoining 

1       a            22-Aug-1980                      10-jan-2000

1       a            22-may-1980                      20-feb-2000

1       a            12-Feb-1980                      15-mar-2000

1       a            3-Aug-1980                      7-jan-2000

how to sort if we click   DateofBirth or Dateofjoining and not sort any where if we click(Id,Name)


access to web form from class

  

hey,

i've read several posts with similar but problems, but i can't find one exactly like what i am seeing.  This is probably very simple...i just can't get the exact solution.

Platform is c#, VS 2010.

I have a web form and code behind file, with scripting that works just fine.  i'm trying to move script from the code behind file into a class, to consolodate and create re-use. The basic problem is when i move the script into the class, i cannot access the webform.

error here on "this":   HyperLink hyplAlertbox = (HyperLink)this.frmEtsuHome.FindControl(codeboxID);

i know WHY it throws the error, i just don't know how to fix it.  any help is appreciated.

below is simplified code....

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

New Script in Code Behind File:


namespace myhome
{
    public partial class _default : System.Web.UI.Page
    {
                    
        protected void Page_Load(object sender, EventArgs e)
        {
             new majorAlerts();
             majorAlerts.GetAlerts();
             majorAlerts.ProcessAlerts(); } } }

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

Code for the Class

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


using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI.WebControls;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls.WebParts;

namespace myhome
{
    public class majorAlerts
    {
        
        public static void GetAlerts()
        {
            // grab the alerts and store them in a list                     
        }

public static void ParseAlerts(List<Alert> lAlerts) {
            foreach (Alert Alert in lAlerts) { // create codebox ID codeboxID = "codebox" + index.ToString(); // find hyperlink with ID of codeboxN cand reate an instance of it HyperLink hyplAlertbox = (HyperLink)this.frmMyHome.FindControl(codeboxID);

//******************* ERROR *************************************************
// ERROR ON this in previous line.  i understand, because "this" is not the form like it is in the code behind file.
// but i don't know how to modify "this" and make it work from class file
// **************************************************************************

 // set hyperlink URL value for alert based on alert ID alertURL = "http://www.blah.com"; hyplAlertbox.NavigateUrl = alertURL; } }




Cannot insert the value NULL into column 'COUNTY', table 'TPI.dbo.juror_tmp'; column does not allow nulls. UPDATE fails.

  

I am attempting to bind data from a dropdown list that was populated from another datasourceID. I've bolded what I believe is relevant to this issue in the code below. But basicly its binding the proper county on the pull down menu but when I hit form submit it dosnt postback that info instead its null.

<asp:FormView ID="FormView1" runat="server" DataSourceID="SqlDataSource1"
            style="margin-right: 59px"
           CellPadding="4"
            ForeColor="#333333" DefaultMode="Edit" DataKeyNames="UID">
            <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
            <EditItemTemplate>
                Edit Item Template<br /><asp:Label ID="uidlabel" runat="server" Text='<%# Bind("uid") %>' /><br />
                last_date ha:
                <asp:TextBox ID="last_dateTextBox" runat="server"
                    Text='<%# Bind("last_date", "{0:d}") %>' AutoPostBack="True"
                    CausesValidation="True" />
                <br />
                first_name:
                <asp:TextBox ID="first_nameTextBox" runat="server"
                Text='<%# Bind("first_name") %>'
                    CausesValidation="True" ontextchanged="first_nameTextBox_TextChanged1" />
                <br />
                last_name:
                <asp:TextBox ID="last_nameTextBox" runat="server"
                    Text='<%# Bind("last_name") %>'
                    AutoPostBack="True"
                    CausesValidation="True" />
                <br />
                mi:
                <asp:TextBox ID="miTextBox" runat="server" Text='<%# Bind("mi") %>'
                    AutoPostBack="True" CausesValidation="True" MaxLength="1" />
                <br />
                home_phone:
                <asp:TextBox ID="home_phoneTextBox" runat="server"
                    Text='<%# Bind("home_phone") %>' MaxLength="9&

How can I hide a field in a gridview but still access its contents

  

With a Gridview, if I have a boundfield or templatefiled with visible="false" I can't get the data.  I need access to some data of a field, but don't want to have it showing up in the gridview.

 

How do I do that? 


"Generic" Nested View Model

  

Not sure I'm going to be able to explain this well enough, but let me try.

I'm going to have a fairly large view model, that's going to need a few nested types.  However I want to find a way making these nested types "generic".

Let's say I got a "ClientType" member.  There will also be a "ClientDetails" nested model, but the members (and validation) of the nested member will depend on what "ClientType" was selected.

On the front end, if you select "Individual Client", you get a partial rendered for you to fill in details required for a person (first, lastname, etc), but if you select "Company" as "ClientType", you get to fill out company details (co name, tax#, etc).

Does this make any sense?




Getting data for a partial view outside the model

  

Hi all -- hope you can help me -- I have been unable to find any explanation of this anywhere.

I have an .ascx partial view that's pulling data from a given model.

I want to populate a drop-down list in my partial view using data from a table outside the model (it is in the same database and entity framework).

I don't know the syntax (I'm pretty much just learning MVC2 and jquery), and don't even know where to start.  I've gotten about as far as <% foreach step in [???] %>, but don't know what to do with it.  What do I put in the "[???]"???

Thanks in advance . . .


Problems Passing ViewModel with data from View to Controller

  

Ok, here is my problem.  I am trying to pass a view model of mine, which has multiple list in it, to my view.  Then in my view i need to edit the different list.  Then on my post i need to save the edits.  Although, when i pass my viewmodel back to my post, it is empty! Can somebody explain what i am doing wrong?

Controller

       

public ActionResult ManageNewsArticles()
        {
            NewsViewModel newsViewModel = new NewsViewModel();

            newsViewModel.ListBreakingNews = db.NewsArticles.Where(n => n.PageSetupID == 1).ToList<NewsArticle>();
            newsViewModel.ListMainArticle = db.NewsArticles.Where(n => n.PageSetupID == 2).ToList<NewsArticle>();
            newsViewModel.ListSubNews1 = db.NewsArticles.Where(n => n.PageSetupID == 3).ToList<NewsArticle>();
            newsViewModel.ListSubNews2 = db.NewsArticles.Where(n => n.PageSetupID == 4).ToList<NewsArticle>();
            newsViewModel.ListSubNews3 = db.NewsArticles.Where(n => n.PageSetupID == 5).ToList<NewsArticle>();

            return View(newsViewModel);
        }

        [HttpPost]
        public ActionResult ManageNewsArticles(NewsViewModel newsViewModel)
        {
            if (ModelState.IsValid)
            {
                db.SaveChanges();
                return RedirectToAction("Admin");
            }
            
            return View(newsViewModel);
        }



here is my View

   
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<TrueNews.ViewModels.NewsViewModel>" %>

    <asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
        Manage News Articles
    </asp:Content>
    
    <asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    
        <h2>Manage News Articles</h2>
    
        <% Html.EnableClientValidation(); %>
    
        <% using (Html.BeginForm(Model)) {%>
            <%: Html.ValidationSummary(true) %>
            
            <fieldset>
                <%: Html.EditorForModel(Model) %>
                <p>
                    <input type="submit" value="Save" />
                </p>
            </fieldset>
    
        <% } %>
        
        <div>
            <%: Html.ActionLink("Back to Admin Controls", "Admin") %>
        </div>
    </asp:Content>



NewsViewModel

   
public class NewsViewModel
        {
            public List<NewsArticle> ListBreakingNews { get; set; }
            public List<NewsArticle> ListMainArticle { get; set; }
            public List<NewsArticle> ListSubNews1 { get; set; }
            public List<NewsArticle> ListSubNews2 { get; set; }
            public List<NewsArticle> ListSubNews3 { get; set; }
        } // End of Class



 
Categories:
.NET
Java
PHP
C/C++/VC++
HTML/XML
SAP
MainFrames
Data Warehousing
Testing
MySQL
SQL Server
Oracle
Javascript/VB Script
Others
Login
 
 
 
 
 Forgot password
 Contact Us   Terms Of use   Share your knowledge