I'm new to Dotnet, can someone please advice - I want to write a CLASS LIBARY which will help multiple functions and they will fetch values from database. This CLASS LIBRARY would then be compiled as DLL and given to other apps to use.
Can anyone provide me link - where I can find good samples of Ado.net or can anyprovide working code which shows me how to fetch multiple or single values from database (writing all this in class library)
Regards
ADO.NET #MSDN is a good starting point.
CodeProject features a good tutorial.
Check this out: Retrieving and Modifying Data in ADO.NET
If you already know how to create and open a connection to database, then read this section: DataAdapters and DataReaders
Go to http://www.w3schools.com/, it will be help lot of can you do better.
Related
I'm new to Azure and started an Azure Mobile App Quick-Start (.NET) project.
I'm studying on this blog wrote by Adrian Hall:
https://shellmonger.com/2016/05/09/30-days-of-zumo-v2-azure-mobile-apps-day-18-asp-net-authentication/. However, I've been confused by the explanation saying that:
Since this is Entity Framework, I would normally need to do an Entity
Framework Code First Migration to get that field onto my database. You
can find several walk-throughs of the process online. This isn’t an
Entity Framework blog, so I’ll leave that process to better minds than
mine. Just know that you have to deal with this aspect when using the
ASP.NET backend.
On the next page, https://shellmonger.com/2016/05/11/30-days-of-zumo-v2-azure-mobile-apps-day-19-asp-net-table-controllers/
The demonstration was using SQL syntax to create/manage the Azure SQL Database, such as: CREATE TABLE... and CREATE TRIGGER... and etc.
So, my question is, with either SQL(like the blog sample shown) or Entity Framework:1) Are they both able to do the exact same stuff?2) Should I only choose one of those methods only?
All the methods discussed (code first, model first, database first) provide you with a way to create a SQL database and update the data within it. The end result is the same - a database with data.
The method you pick tends to rely on where you prefer the 'intelligence' for your data to live - with the database or with the code.
Do you already have an existing database you'll be using?
Go database first, so you can automatically generate code and classes from the database.
Do you know SQL? Do you prefer to use your database for data only (i.e. no stored procedures or validating data inside the database)?
Go code first, you have full control of your model from the Code, and its a bit easier to keep databases in sync with your application.
There are a few more considerations that can help skew you to a different method. You can take a look at this blog post from Roland about the pros and cons of each approach.
There's also a StackOverflow thread that summarizes the differences between the methods.
I am just trying to use flyway for the first time. So I put relevant clarifications as one post here. Please apologize. Am trying to make our two development test dbs (oracle) as sync or maintained with version. I have below clarifications on that.
1.Practically we have around 4000 objects in our db. Is this tool compatible and fast enough to handle this many objects?
We don't want to maintain data level version control for all the tables. For examples for transaction tables we don't want to sync production and development. Rather some configuration tables or master tables data needs to be maintained. Is it possible?
Let us by assume example db1 will be considered here as production and db2 will be considered as development. For that should we have to generate a SQL script manually that includes the entire DDL and all tables dml for db1? or flyway has command/option to do that?
Please clarify the above questions or guide me any documentation to refer to try in test set up to familiarize before to implement in actual project.
Thanks in Advance
Balaji
We are going to develop many small applications using asp.net (c#) with oracle database. I would like to write a simple class library say dataaccess.dll that has most of the functionality for connecting to database, executing a sql query, update or insert or delete etc so that i could reuse them in my many small projects. Is there a good example online somewhere that i can get started from?
Well, probably i didnt explain my question properly..
I am not looking for how to make asp.net connect to oracle or how to execute a query (throught odp.net) from asp.net .
I am looking for ways to construct a class library with methods such as connect(),executeQuery(),insert(),update(),delete() methods which would accept connectionstring,sql query text etc as parameters from any c# program. What i want is a generalized dataaccess code or guideline to develop one based on odp.net that i can reuse again and again.
Thanks.
Search around for ODP.net which is what you'll be using. This is a helpful search term, but you'll find a lot of examples for your specific needs.
Look for pages that explain how to set up your classes to use the connector such as http://ergemp.blogspot.com/2008/10/querying-oracle-with-c-and-odpnet.html
Make sure to pay attention to the type of objects you're using to select data and don't confuse SqlDataSource with OracleConnection.
Look for pages detailing the use of the Oracle client, Oracle.DataAccess.Client.
You may know most of this, but in case someone find this question and doesn't, they get some info.
I'm looking for a connector for CKFinder that will enable it to use images stored in a SQL Server database as binary data. Google has turned up much and I was wondering if perhaps done anything like this and can refer me to some code?
If you are looking for an official one, there isn't a one and it looks like there will not be one. I created a trac ticket for this and it got rejected.
They are kind of right in that it's complicated to write a generic connector, because the backend could be MySQL, MSSQL, PostgreSQL, Oracle or any other SQL server running on any platform.
Backups and migrations aside, the best reason to use an SQL backend (at least for me) is for storing metadata and that would still require some custom SQL, because they could have no idea what I want to store and how.
I know this is not a solution so -1 if you feel like it. I have not found any instructions other than the official Server Side Integration guide mentioned in the ticket.
What you need is a handler. You are trying to read a binary image from a database and serve it to a user (or page - depending on the need).
You can see an example here:
http://weblogs.asp.net/cazzu/archive/2003/08/27/25568.aspx
It would help to know who -or what- is going to consume the image. Are you creating an image store? So at that point you would reference the Handler in your web.config and then create a Gridview or DataList that references the images and the Handler will render them for you at runtime.
Is there some kind of simple database system that uses simple text or xml files for data storage? I just need some basic functionality like update,delete, insert, simple constraints and relations.
For the project that I have now using SQL Server would be too heavyweight and I have never really liked it anyway.
Yes it is: SQLite :)
There is ADO Provider:
http://sqlite.phxsoftware.com/forums/default.aspx?GroupID=2
There is article on that:
http://www.aspfree.com/c/a/Database/Using-SQLite-for-Simple-Database-Storage/
The DataSet from the .NET Framework is also an option. See DataSets, DataTables, and DataViews (ADO.NET) on MSDN.
Theoretical:
XML as Data Source
Manipulate XML File Data Using
C#
These projects will give you an idea
Roll Your Own Database
Using XML as Database with Dataset
SqlCompact is a great option for this. There is no engine or setup, just include the .dll and you can create a database on the fly.
http://www.microsoft.com/downloads/details.aspx?FamilyId=DC614AEE-7E1C-4881-9C32-3A6CE53384D9&displaylang=en
-- EDIT: like #MathewMartin said: SqlCompact 4.0 is intended to be a web database and allows multiple connections.
SQLite is a good option.
Since your using .net though, i'd consider just using xml and LINQ to XML, it's very sql like in many ways.
Check this Stack Overflow question: Free portable database
There you will find list of "lightweight" databases.
If you prefer object database, then consider using NDatabase.