Hi there,
i am new with asp.net and i would like to start with it!!!

I was wondering if anyone could suggest me any good and easy to understand tutorial where i can learn how to make a list from sql and edit the record in a new page (add, update, delete records.. etc, etc)

If someone is so kind to send me some code already done, will be greate!!! (at : grafic.web@gmail.com)

Thaks for your help

Recommended Answers

All 7 Replies

If you are new to asp.net, you may want to start by visiting their official site, http://asp.net.

They have many tutorials and examples to work with.

There are lots of sites online that have videos and other tutorials.

Where you go will depend also on if you are interested in Web Forms, MVC, Razor, etc...

Go ahead and install Visual Studio (free download for Express version). It will include templates and example sites to work with as well.

I don't believe that you can't find your tutorials through google or youtube.
There's so many sample and tutorials. Try doing your research, once you are stuck at somewhere, you are welcome to ask us.
Happy coding.

Hi, thanks for your answers, very fast!!!!

I actually found something but i don't understand why all the example fill the label with data or datagrid or dataview... can i fill with simple text html??

I mean, i have my connection to sql, how can i show the records of my table ("users") making my own list design?

Another question, i saw that visual web express allows you to create automatically a login user with editing etc etc, how can i do this by my self? with classic asp i was using cookies, but with asp.net c# it looks different.. how can i save my variables taken from my sql database? (cookies, sessions or others?) is there anybody who can give me some code already done to study?

Thanks for your help mates

why all the example fill the label with data or datagrid or dataview...

because these rich controls are supposed to help you develop quicker.

can i fill with simple text html??

yes of course. In your code behind, you can read from the database and construct the HTML (during the reading/looping process) then insert that HTML most likely in a placeholder control.

visual web express allows you to create automatically a login user with editing etc etc, how can i do this by my self?

You would have to code itas you did when working with Classic ASP. Using textbox controls to capture username and password, then logic to take that information and find a match in your users table. If you find a match, store the information in a session/cookie. Before you do that, research forms based authentication. Its not the full blown automated thingy you are referring to, but does allow you to manually build the login stuff and just use a few built-in methods and web.config to manage the cookie and security where users are allowed to access.

how can i save my variables taken from my sql database? (cookies, sessions or others?)

yes those are common methods. If you only need to store the data for the duration of the session, a session variable can be used. If you need to store it past the legth of the session, you can use a cookie.

is there anybody who can give me some code already done to study?

What code are you looking for? In any case, its really hard to take someone's code and learn directly from it. I think the best approach is to go through turorials from a book, online resources, do examples, etc...

this is why i recommended the site, http://asp.net

Thanks a lot for your answer JorgeM !!!

Thanks for all the tips!!!

For the code.. i was wondering if someone could give me some code already done to show sql records in html and editing those records..

Thank you so much for your time

In the very first beginning. When you create a new project, in the root directory has a file name Web.config

<configuration> 
 <connectionStrings>
    <add name="conn" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\MSJDatabase.mdf;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient"/>
  </connectionStrings>
</configuration>

You just have to change the MSJDatabase.mdf to yours database name. P/S (i only know MySQL)

Code Behind
...
using System.Data.SqlClient;

namespace Testing
{
    public partial class Webform1 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionString["<dataname name where you declared in web.config>"].ConnectionString;
            SqlConnection cmd = new SqlConnection(" //Your sql query ", con);
            //If you want compare your database value with controls, example
            SqlConnection cmd = new SqlConnection("SELECT * FROM Customer WHERE CustomerName=@name", con);
            cmd.Parameters.AddWithValue("@name", txtCustomerName.Text);
            //Remember, must open the connection first before you fire your query. When after finish use remember to close it.
            con.Open();
            //if your sql query is SELECT statement
            SqlDataReader dtrRead = cmd.ExecuteReader();
            while(dtrRead.Read())
            {
                //Your Action
            }
            dtrRead.Close();
            //if your sql query is non-SELECT statement
            cmd.ExecuteNonQuery();
            //at last close your connection
            con.Close();
        }
    }
}

Hope this is helping you

This is perfect!!! Thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.