Better way to connect database in MVC

Hi,
Iam doing ASP.net MVC application.
i am connecting database instance through controller, models i am using just to process the data and give data structure to view.
I red some articles it saying "controller is just act like interface between model and view, all other process and database connections has to be part of model" 
Now my confusion is why i am  using controller to connect DB.
which approach is make me to follow better coding standards, connecting DB through model or controller ?
Regards,
Sekhar 

Hi Sekhar,
We discuss SQL Server Reporting Services related issue in this forum. If you have any more question regarding MVC application, I would suggest you open a new thread in the forum below for better support:
MVC forum: http://forums.asp.net/1146.aspx
Thanks for your understanding.
Regards,
Elvis Long
TechNet Community Support

Similar Messages

  • Better way to connect to PC

    Is there a way I can have a single link to all the shared folders on the PC in one Window?
    I'm a new Mac user and trying to connect to my PC.
    I tried a few different ways while I was muttling through the process and at one point I thought I had it. I think I was able to browse through all the shared folders on the PC from the Mac, but I couldn't see the Mac from the PC. Once I renamed the workgroup to match the PC, I could easily browse all the folder on the Mac from the PC, but now my access to the PC has changed.
    When I connect to the PC, I'm given a choice of which shared folder I want to connect to, and an icon link for that single folder appears on the desktop.

    Hi Chip, all my PCs are switched to Linux at the moment, so I can't test it, but I think there's 2 ways... or more.
    First, I think you could place Shortcuts to the Folders you wish to access on the PC, into one Folder on the PC.
    On the Mac side you could make Aliases of those Icons once mounted, and put them in a Folder on the Mac, then you could even drag that folder to the Dock, between Applications and Trash, so you get a popup menu of the PC's Folders.
    Though a security problem if the PC is connected to the Internet... I just Shared the whole C:\, D:\, E:\, etc. with my Macs

  • Better way to connect nylon camera strap?

    I'm concerned about the connection to the slender metal slots on the side of my 7D.  Is there a more sure method -- the 7D is heavy and I recently had a strap separate at the juncture.

    I don't use the factory strap -- partially for this reason, but mostly because of comfort.
    Check out either (or both) the Black Rapid straps and the Carry Speed straps.    They make several models.  I use a BlackRapid RS-7 strap.  
    These straps attach to the tripod mounting bolt socket on the bottom of the camera (or to the bolt socket on a lens mounting collar if you've got a heavy lens attached.)  The mount bolt slides on the nylon strap and you wear the streap over the shoulder opposite where you rest the camera.  This means the camera rests quite comfortably upside down when you're not using it.  When you grab the camera to lift it to your eye for shooting, the bolt connector slides up the strap.  It includes some limiters which allow you to restrict how far it can slide.
    These things are MUCH more comfortable if you're going to be wearing a camera all day.
    The traditional strap was designed in a time when a cameras didn't have long lenses.  Today's camera lenses make the camera point downward and that puts a pinch on the strap connection as well as makes the camera not very comfortable to wear.
    The Carry Speed brand strap has an optional attachment plate which also includes an Arca-Swiss style dovetail plate so the camera can still be mounted to a tripod head (as long as the head has the standard Arca-Swiss style 1" wide dovetail saddle.) without needing to remove the strape or plate (although disconnecting the strap is a simple operation and you can leave the dovetail plate attached.)
    Tim Campbell
    5D II, 5D III, 60Da

  • What is the best way to connect macbook to hd tv?

    right now i'm using kanex minidisplay port to hdmi adapter. Just wondering if there is a better way to connect to a hdtv. mostly for watching movies.

    I am using the MOSHI adapter and it is much better. The Kanex got very hot.

  • How to Connect Database Using Script?

    Hi all,
                    Am using Adobe InDesign CS3. Is there any way to connect database from Adobe InDesign CS3 Scripting (Javascript)? Thanks in advance.
    Regards,
    Mohan

    I don't know javascript so I can't help with that part.
    The system plug in you need is from Actual Technologies : http://www.actualtechnologies.com/ The setup for that is detailed in their instructions. You will probably want to set it up for system-wide access, not by user. I found system-wide access more reliable, fwiw.
    For Applescript I send a command through the Terminal/command line that returns the data from the query.
    Here is Applescript:
    set query to "YOUR DB QUERY"
    set results to (do shell script "echo \"" & query & "\" | iodbctest \"dsn=" & dsn & ";uid=" & uid & ";pwd=" & pwd & "\" | awk '{ if (match($0,\"SQL>\")) {k++; if (k==1) next; if (k==2) exit; } if (k==1) print; }'")
    You can probably do something similar in Javascript. You'll have to parse out the text data returned then. I think there may be plug-ins for InDesign that can directly connect to a database (?). Or some plug-ins like inData can take their data passed from a script as well.
    Chris

  • I am having trouble transferring files from an old MacBook (2007) to a MacBook Air over a wireless network.  The connection was interrupted and the time was over 24 hours.  Is there a better way to do this?  I'm using Migration assistant.

    I am having trouble transferring files from an old MacBook (2007) to a MacBook Air over a wireless network.  The connection was interrupted and the time was over 24 hours.  Is there a better way to do this?  I'm using Migration assistant.  The lack of an ethernet port on MacBook air does not help.

    William ..
    Alternative data transfer methods suggested here > OS X: How to migrate data from another Mac using Mavericks

  • Hi guys Pls tell me a way to connect db4 database with jsp and which driver

    hi guys
    Pls tell me a way to connect db4 database with jsp and
    also tell me which driver i have to use
    also tell me how to connect with excel sheets

    take a look at the follwing links. There, you'll find all what you need :
    DB4:
    http://www.oracle.com/database/berkeley-db/je/index.html
    http://www.oracle.com/technology/products/berkeley-db/je/index.html
    http://www.oracle.com/database/berkeley-db/db/index.html
    http://www.oracle.com/database/docs/berkeley-db-je-datasheet.pdf
    Excel:
    http://64.18.163.122/rgagnon/javadetails/java-0516.html
    Hope That Helps

  • I want to know the ways of connecting 9iAS to Database and clients to database through 9iAS as middleware.

    My question was about the necessity of implementing OID or any other version of LDAP.
    We have a new 9iAS and 8.1.7 database implementation and i have a doubt about their networking architecture.
    I want to know the ways of connecting 9iAS to Database and clients to database through 9iAS as middleware. We are debating if OID is compulsory or if we can go ahead with this implementation with out OID.
    Can you please help me and provide me couple of implementation designs(i.e connecting clients to database through 9iAS). It would be great if any one can provide me the implementation's with and with out OID.
    -Thanks

    Hi ,
    For all delta and full DTP loads you can get  information in table  RSICCONT .Check table  RSMONICDP  this will give you detail information .Here you will get all the information with timestamp and request id .
    Hope these tables will serve your purpose .
    Regards,
    Jaya

  • A better way to do this ?

    where does the sql stuff excute in the following stored procedure, directly in the database or it goes through the oracle VM first ?
    CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED "CustomExport" AS
    import javax.sql.Connection;
    import oracle.jdbc.OracleDriver;
    import java.sql.DriverManager;
    import java.sql.SQLException;
    public class CustomExport
    public void do() throws SQLException{
    OracleDriver oracle = new OracleDriver();
    DriverManager.registerDriver(oracle);
    Connection conn = oracle.defaultConnection();
    PreparedStatement st = conn.prepareStatement("select from table where col=?");
    st.setString(1,"value");
    ResultSet rs = st.execute();
    and is there a better way to read and parse an xml document with PL/SQL.what i've read about is the ability to parse an XML file to load its data directly into a database table.What i was looking for was just a way to parse XML without having to load any data into tables so i did it with java.
    CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED "CustomParser" AS
    import javax.xml.prasers.SAXParser;
    import javax.xml.parsers.SAXParserFactory;
    import org.xml.sax.Attributes;
    import org.xml.sax.InputSource;
    import org.xml.sax.SAXException;
    import org.xml.sax.helpers.DefaultHandler;
    public class CustomParser
    private static CustomParseHandler handler = new CustomParseHandler();
    public static void parseXMLFile(String fileName) throws FileNotFoundException,IOException,SAXException
    SAXParserFactory saxFactory = SAXParserFactory.newInstance();
    SAXParser parser=saxFactory.newSAXParser();
    parser.parse(new FileInputStream(fileName)),handler);
    private class CustomParseHandler extends DefaultHandler{
    StringBuffer buff;
    public CustomParseHandler()
    this.buff = new StringBuffer();
    public void startElement (String uri, String localName,
    String qName, Attributes attributes)
    throws SAXException
    buff.append("<").append(qName).append(">");
    public void endElement (String uri, String localName, String qName)
    throws SAXException
    buff.append("</").append(qName).append(">").append(newLine);
    public void characters (char ch[], int start, int length)
    throws SAXException
    String fieldName = new String(ch,start,length);
    if(fieldName==null || "".equals(fieldName.trim()))
    return;
    public void clearBuffer(){
    buff.delete(0, buff.length());
    public String getXMLString(){
    return buff.toString();
    }

    PLSQL does not go through Java to access the database. The actual access to the database is via the same mechanism for both, so in some sense, both perform about the same. However, PLSQL datatypes have the same representation as database datatypes so there is no conversion. Java datatypes have different representations than database datatypes so there is a conversion cost associated with moving data between Java and the database.
    If your processing is simple and you are moving a lot of data, PLSQL is likely the better choice. If your processing is more complex and you are moving less data, Java is likely the better choice. There are other things such as portability you should consider, but the amount of data and complexity of the code are the first considerations.
    Douglas

  • A better way to make Automator mount a volume?

    I made an Automator application, using the Record function, to mount a volume on a drive connected to my Mini. I also made a similar one to eject it. I use them as Calendar-triggered events as part of my backup scheme.
    They work well ... until I restart the Mini, when occasionally my two connected drives will mount in a different order. What happens then is that the sequence of mouse clicks recorded in Automator don’t find the correct volume.
    I wonder if there’s a better way to automate the mounting of a currently ejected disc (and later its ejection). Automator, as far as I can see, does not have the actions I need. It has Ask For/Connect to/Get specified Servers, but they seem only to be for network-connected stuff.
    Anyone know a better way?

    Welcome to Unix. 
    The key part of that shell script code is the test for the existence of the mount point (if [ -e /Volumes/dbamp ]), followed by a conditional block that — in the "else" section involved when the mount point wasn't found — creates it, and then mounts an AFP file system on that mount point.  Most of the rest of the baggage in that script is used to get the mysqldump database dumps over onto the target disk, once it's been mounted.
    Here's a very quick overview of the basics of scripting , Apple's introduction to the command line manual, there's a generic bash intro (which is good, but doesn't line up exactly with how bash is implemented on OS X) and O'Reilly has some reasonable books on bash and bash scripting.  Once you know and are comfortable with the basics, there are advanced bash guides available.

  • Looking for a better way to count responses to survey questions

    Hello all - I've created a survey for a site and now want to display the results for the site admins. I am simply trying to display the counts - the number of times a question has been answered a certain way. I realize that I may need to construct the survey itself differently and how it stores the data, but here's how it goes so far.
    There are 10 questions, each with 4 options in radio button groups. The database table has a column for each question and stores the value of the selected radio button. So that's pretty simple.
    Now on the results page this is the only way I can think of doing it, but there has to be a better way. For each response, I create a recordset filtered on the question and option value, then display the total record count. That works just fine, but to count each option, that means 40 recordsets on the page - al to merely determine "How many times was Question 1, Option A selected, and How many times was Question 1, Option B selected, and so on.
    The only other thing I can think of, there perhaps is a better way to count the occurrences of these values in the table either with PHP or in the SQL itself.  Or, perhaps if the values themselves are all numeric and follow some sort of pattern I can use a math solution.
    Any thoughts, solutions and ideas are welcome!  Thanks. 

    THANK YOU!!
    I used this format before actually for an exam in an online training program, and I don't know why I didn't make the connection.
    I also want to connect the responses to the participant, but I think that would even be secondary to the survey itself.
    So just to clarify, if you would, I would have a survey table l like I do now, with each survey generating an ID with each one and perhaps the user info or a column for User ID. Then, the questions table each with an ID to populate the questions, a options table, each with its own ID and linked to the questions that populate the options.
    Finally a responses table that records the Survey ID, Question ID and Option ID with each record.
    In the exam I did before, the questions and responses were in the same table, so I suppose I could make it work that way too. But, now I know why I didn't think of this - unlike the exam where each question was presented one at a time, the survey is on a single page and would require a multiple record insert - which I haven't done as much as single inserts, so it didn't pop into the head.
    L

  • Best way to connect CF10 DB Connection to FoxPro?

    In previous versions of CF this was a pain. Now in CF10 it seems even more so.
    I need to connect to a Microsoft Visual Fox Pro database from ColdFusion 10 running on Windows Server 2008 R2 64 bit edition.
    Can someone point me to a tutorial on how to get this working with a JDBC or ODBC (not likely) solution?

    Re: Best way to connect X-Fi elite pro to logitech z5500? ok after a long time i had some progress today finally . so i found out there is no DD or DTS encoder software coming for x-fi elite pro automatially and it has to be purchased from : http://buy.soundblaster.com/_creativelabsstore/cgi-bin/pd.cgi?page=product_detail&category=Software&pid=F 2222DDN6Z2H2ADDEZD
    after that u get the same output no matter u use optical, coax or analogue connection. so i pretty much now get the same result by using any of these connections.
    and finally this package is really usefull , actually way better than the drivers creative provides itself : http://forums.creative.com/t5/Sound-Blaster/SB-X-Fi-Series-Support-Pack-2-0-05-5-2009/m-p/527485
    i almost retured this soud card toda but after i could fix my problem, i start loving it again lol

  • Now that Garageband is on the iPhone, is there any way to connect a Korg nanoKey to it?

    The subject says it all - I'm wondering if there's any way to connect a Korg nanoKey to my iPhone 3GS running the current version of iOS.
    Thanks and have fun!

    It would take a significant amount of work as you would have to change the pages to PHP. You would also lose any more compatibility with Muse.
    An alternative would be to host with Adobe Business Catalyst and upgrade to the eCommerce hosting plan and do your database functions using Business Catalyst Web Apps. It is a bit of a learning curve but in my opinion the better option than hosting on third party hosting and trying to convert everything.
    Keep in mind that even if you change the pages to php to add mySQL connection this would all have to be done by hand or with Dreamweaver. Muse does not support Database connectivity or dynamic content. The only real practical workaround is to use Business Catalyst along with Muse.

  • Best way to configure database access - direct or intermediary

    Hi there all,
    I'm brand new to Java but have done a fair bit of php
    what is the best way to architect a multi user applications connection to a database (from both performance and reliability)
    The way I see it I have 2 options:
    Every client application has a built in database connection string and performs its own queries interacting directly with the database.
    Or
    Clients use sockets/web service (which is better?) to connect to a multi threaded server app that then handles the request and performs the SQL query on the database and returns the results
    Thanks in advance
    Tyrone

    It's going to depend on your business model isn't it? Can you do client server or do you have to do n-teir?
    Do you have middleware that you want to use and do you want any type of middle teir that keep business rules.
    Can you make your DB visible to the end user or are you prohibited?
    Generally: if you are going to expose to the web, then you want as much security between your data and the client as possible, so n-teir will win out there in many instances.

  • Attn - The correct way to connect to the repository

    From iFS Product Management.
    Many people appear to be having trouble connecting to the repository and are using the wrong API calls to do. The recommended API calls changed between beta and production. For the production release here is the correct way to connect:
    1. Four pieces of information are need to connect to the repository
    1. The iFS User Name
    2. The iFS User's password
    3. The properties file to be used
    4. The database password of the user who owns the iFS Schema
    This is different from the beta where the database password was hardcoded into the properties file.
    Note that any TNSNAMES information is still containing in the databaseURL entry in the properties file.
    package ifs.demo.samples;
    import oracle.ifs.beans.*;
    import oracle.ifs.common.*;
    import java.util.Locale;
    public class ConnectionTester extends Object {
    public static LibrarySession testConnection()
    throws IfsException
    LibraryService service = new LibraryService();
    CleartextCredential me = new CleartextCredential("gking","ifs");
    ConnectOptions connect = new ConnectOptions();
    connect.setLocale(Locale.getDefault());
    connect.setServiceName("IfsDefault");
    connect.setServicePassword("manager");
    return service.connect(me,connect);
    public static void main(String[] args)
    try {
    LibrarySession ifs = testConnection();
    ifs.disconnect();
    } catch (IfsException e) {
    IfsException.setVerboseMessage(true);
    e.printStackTrace();
    Note that in this example "gking" is the iFS user name, "ifs" is the gking user's ifs password. "manager" is the password of the database user who owns the iFS Schema.
    "IfsDefault" is the server properties file that describes the ifs connection. This file is in called "IfsDefault.properties" and is located in the package oracle.ifs.server.properties". This means that the folder that contains the 'oracle' folder that is the root of this package must be referenced in the class path when running this example.
    Note, if you use the older, 3 argument form of the connect you will get an unable to connect exception as the iFS will not have the Schema Password.
    null

    When I run the example below on Solaris (after setting the CLASSPATH etc., I get a oracle.ifs.common.IfsException: IFS-21008: Login Failure
    oracle.ifs.common.IfsException: IFS-10170: Invalid name/credential.
    (I am providing all 4 pieces of information for connecting)
    When using the web interface the same userid and password work fine (system/manager).
    Please help.....
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Mark_d_Drake ():
    From iFS Product Management.
    Many people appear to be having trouble connecting to the repository and are using the wrong API calls to do. The recommended API calls changed between beta and production. For the production release here is the correct way to connect:
    1. Four pieces of information are need to connect to the repository
    1. The iFS User Name
    2. The iFS User's password
    3. The properties file to be used
    4. The database password of the user who owns the iFS Schema
    This is different from the beta where the database password was hardcoded into the properties file.
    Note that any TNSNAMES information is still containing in the databaseURL entry in the properties file.
    package ifs.demo.samples;
    import oracle.ifs.beans.*;
    import oracle.ifs.common.*;
    import java.util.Locale;
    public class ConnectionTester extends Object {
    public static LibrarySession testConnection()
    throws IfsException
    LibraryService service = new LibraryService();
    CleartextCredential me = new CleartextCredential("gking","ifs");
    ConnectOptions connect = new ConnectOptions();
    connect.setLocale(Locale.getDefault());
    connect.setServiceName("IfsDefault");
    connect.setServicePassword("manager");
    return service.connect(me,connect);
    public static void main(String[] args)
    try {
    LibrarySession ifs = testConnection();
    ifs.disconnect();
    } catch (IfsException e) {
    IfsException.setVerboseMessage(true);
    e.printStackTrace();
    Note that in this example "gking" is the iFS user name, "ifs" is the gking user's ifs password. "manager" is the password of the database user who owns the iFS Schema.
    "IfsDefault" is the server properties file that describes the ifs connection. This file is in called "IfsDefault.properties" and is located in the package oracle.ifs.server.properties". This means that the folder that contains the 'oracle' folder that is the root of this package must be referenced in the class path when running this example.
    Note, if you use the older, 3 argument form of the connect you will get an unable to connect exception as the iFS will not have the Schema Password.<HR></BLOCKQUOTE>
    null

Maybe you are looking for