Thursday 12 January 2012

ASP.Net | Creating Objects | Neha Sharma

Hiii All,


Here now i am going to tell you how you can use your Connection Class on your application's every page ,so that you can enter data in to table.

Now the situation is juzt like you have your connection but dont have ryt method to use that,
so create an object on desired page like default.aspx.cs,add two namespaces:

using System.Data;
using System.Data.SqlClient;


Now above page_load event write this code"

myconn conn=new myconn();

this line will fetch all objects from your class myconn.

So i think it's not tough or not even a bit difficult .

Enjoy programming.....

---------
Thanks

Wednesday 11 January 2012

ASP.Net | Connection String | Neha Sharma

Hii Dear,

Here i am going to tell you all how you can create a connection String using a class with C# language for a database in SQL Server 2008 Express edition,dont be panic it's so easy follow these steps:

1.Add new Item -> Select a Class(C#) -> Give a name to that Class

2.Add two NameSpaces:

using System.Data;
using System.Data.SqlClient;

3.Write code like following:


using System;


using System.Collections.Generic;
using System.Web;
using System.Data;
using System.Data.SqlClient;


///
/// Summary description for MyConn
///

public class MyConn
{
public SqlConnection con = new SqlConnection();
public SqlCommand cmd = new SqlCommand();
public SqlDataAdapter adp = new SqlDataAdapter();
public DataSet ds = new DataSet();
public DataRow dr;

public MyConn()
{

con.ConnectionString = "Data Source=meha-pc\\sqlexpress;DataBase=dbname; user ID=abc; password=abc";
adp.SelectCommand = cmd;
cmd.Connection = con;
//
// TODO: Add constructor logic here
//
}


For connection String you can select your authentication mode as per your SQL Server Security Settings,here i select server authentication for the the databse dbname,if you select Windows authentication write "Integrated Security=true " at the place of user ID=abc; password=abc" .



-----------
Thanks

Connection String

"Connection String", is a Simple question strike in mind whenever someone is going to start work on Visual Studio with SQL Server.Connection String works just like a bridge to connect your application with your database.it doesn't matter, which kind of database are you using in your Server,It may be .xls or .mdb or may be .dbo .You have to just create a connection between your application and database.

For Example:

1.For .xls

strConnection = _T("Driver={Microsoft Excel Driver (*.xls)};DriverId=790;"
bq=C:\\DatabasePath\\DBSpreadSheet.xls;DefaultDir=c:\\databasepath;");

2.For .mdb

add name="MasterSoftware.Properties.Settings.DbConnectionString"
connectionString="Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\Db.accdb"
providerName="System.Data.OleDb"


3.For .dbo

add name="MyConnectionString" connectionString="Data Source=my-pc;Initial Catalog=dbname;User Id=abc;Password=abc;"



The Second and most important thing is that ASP.Net provides connectivity from ADO.Net,it provides disconnected mode of connection,so that we can work virtually with our tables.

it's so simple and easy to learn these stuffs,i can explain here you later all things read continuously and carefully and feel free to clear any query.


Thanks.

Which Game Engine you should choose | Neha Sharma

Unity3D and Unreal Engine are only 2 Game engine which executes an indispensable position in Game Industry. The choice of the engine must ...