Welcome and forget about PHP! :)
It's a bit confusing when you first get started and the short answer
is yes.
Depending on how you want to display the data in your webparts, say
retrieve a list of users into a dropdown box, you can do your magic in
sql, use our data ADO.NET classes such as "DataReader", "DataSet" or
"DataTable", you can bind your results to them. A quick example using
sqlserver
SqlDataReader rdr = null;
SqlConnection con = null;
SqlCommand cmd = null;
try
{
// Open connection to the database
string ConnectionString = "server=xeon;uid=sa;"+
"pwd=manager; database=northwind";
con = new SqlConnection(ConnectionString);
con.Open();
// Set up a command with the given query and associate
// this with the current connection.
string CommandText = "SELECT FirstName, LastName" +
" FROM Employees" +
" WHERE (LastName LIKE @Find)";
cmd = new SqlCommand(CommandText);
cmd.Connection = con;
// Add LastName to the above defined paramter @Find
cmd.Parameters.Add(
new SqlParameter(
"@Find", // The name of the parameter to map
System.Data.SqlDbType.NVarChar, // SqlDbType
values
20, // The width of the parameter
"LastName")); // The name of the source column
// Fill the parameter with the value retrieved
// from the text field
cmd.Parameters["@Find"].Value = txtFind.Text;
// Execute the query
rdr = cmd.ExecuteReader();
// Fill the list box with the values retrieved
lbFound.Items.Clear();
while(rdr.Read())
{
lbFound.Items.Add(rdr["FirstName"].ToString() +
" " + rdr["LastName"].ToString());
}
}
catch(Exception ex)
{
// Print error message
MessageBox.Show(ex.Message);
}
finally
{
// Close data reader object and database connection
if (rdr != null)
rdr.Close();
if (con.State == ConnectionState.Open)
con.Close();
}
txtFind.Text is a textbox value on the page and lbFound is the
dropdownlist name.
Example taken from
http://www.akadia.com/services/dotnet_data_reader.html
Hope that helps.
Liming Xu
Jumptree Project Management
www.jumptree.com
On Mar 21, 9:52 pm, itfet...@gmail.com wrote:
I've been programming a bit in PHP and then recently learnt classic
ASP for projects at work, now I'm working on another project that they
want done in .net. I've got my head around web parts, that wasnt as
complicated as I thought it would be.
Now I want to create a web part, that connects and uses our database
to show data depending on what user it is.
I know theres the dataview controls and all that, but I dont want to
display all the data, I just want to have the data in a recordset like
you could in classic so then I can manipulate it and display it how I
want.
Can you even do that anymore, Ive been reading guides but they all
talk about data acess layers which seem like more complication than I
need.
Can anyone point me in the right direction, or link to a good simple
guide on doing such a thing, I'm really confused.