0

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

3
Contributors
7
Replies
33
Views
3 Years
Discussion Span
Last Post by grafic.web
0

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.

Edited by JorgeM

0

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.

0

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

1

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

0

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

2

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 question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.