sql server 2005 compact edition de downloadat

A aparut Microsoft SQL Server 2005 Compact Edition

Se poate downloada de aici
http://www.microsoft.com/sql/editions/compact/downloads.mspx

Comparatie intre SQL Server Express si Compact aici( vedeti in dreapta documentul Word)
http://www.microsoft.com/sql/editions/compact/sscecomparison.mspx

Ceea ce m-ar interesa este ca acest compact sa se comporte ca un fel de MDB – sa poti sa faci deploy fara sa te gindesti la scripturi, etc – pur si simplu sa il copiezi …

cu ce m-am mai batut in ultimul timp

cu optimizare aplicatie sa mearga mai repede – si am reusit sa gasesc articolul asta
http://www.mostlylucid.co.uk/archive/2003/12/09/664.aspx

in care spune ca intr-un gridview e mai rapid sa faci conversia la obiect + proprietati decit eval -care foloseste late binding

adica – folositi asta
  <asp:Label ID=”lblNume” runat=”server” Text='<%# string.Format(“iata {0}”,((obiect)Container.DataItem).nume) %>’ ></asp:Label>

in loc de asta

<asp:Label ID=”lblNume” runat=”server” Text='<%# Eval(“nume”,”iata {0}”) %>’></asp:Label>

M-am mai batut cu property grid si cu ICustomTypeDescriptor – si am observat ca property grid cheama
GetProperties(Attribute[] attributes) – cu atributul browsable – iar un dropdownlist binduit cheama GetProperties() simplu ( de ce il cheama – iata o minune – probabil vrea sa se asigure ca exista proprietatile inainte de a le chema …)
Concluzia : implementati GetProperties(Attribute[] attributes)  pentru un property grid cit mai bun si GetProperties() lasati-l cit mai simplu pentru asp.net

ASP.NET application

Now, it’s time to make
the ASP.NET application. I suppose that you have already installed Internet
Information Services (you will find in the Administrative tools folder) . If
not, please install and run aspnet_regiis.exe that you will find into
<WindowsPath> \Microsoft.NET\Framework\<latest version> (my path is
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727)

 

Install SQL Server
Express(<Address>) and WebDeveloper(<Adress>) – no install of SQL
because you have done this already.

 

Now it’s time to
import our data to the SQL Database. Start SQL Server Management Studio and you
will find the databases already installed.Create a new database (name: Book)
and import the mdb database into this new database. Right Click on Book =>
Tasks= > Import data .

In the first screen
choose as data source Microsoft Access


 

The next screen is
correctly completed – as you can, use windows authentication.

Choose next “Copy data
from one or more table or views” and click “select all” in the following
screen.

You can now press Finish
and make the task.

 

Some modifications are
necessary to be done:

Choose Book=>
Tables in SQL Server Management Studio. Right click Publisher table and press
modify.

We must make IDPublisher
an auto number like in Access, In SQL Server, auto number is named identity.


 

As you modify the (Is
Identity) property, you will see the identity incremend and seed to be modified
also in 1 and 1.

Save the table.

The next step is to
create a folder where we create the internet program.

Goto C:\Book and
create a new folder , named BookWeb

Now , from the Administrative
Tools folder double click Internet Information Services and expand (local
computer)=> WebSites=> Default Web Site.Right click Default Web Site and
choose New => Virtual Directory. Click next. In the Alias please enter
BookWeb. For the directory enter C:\Book\BookWeb .Press twice “Finish” and we
are ready.

 

Now we are ready to
program our first page in ASP.NET.

As usually we will
have a list page and create/update/delete pages for Publisher.To make the possibility
that the site has an unitary interface, we will create a master page
–Book.master.

Open Microsoft Visual
Web Developer 2005 Express Edition and choose Open Web Site like in the image:


 

Choose “Local IIS” tab
and “BookWeb” as virtual directory

Now we will cre

In the “Solution
Explorer” right click the http://localhost/BookWeb
and choose              Add new Item – and choose Master Page and name it
“Book.master”.Do not forget “ Place code in separate file”    

 

The interface of the
master page will be rather simple  : a
table that has 2 rows and 2 column , the upper row being an unique cell

 

The content is here:

<%@ Master Language=”C#” AutoEventWireup=”true” CodeFile=”Book.master.cs” Inherits=”Book” %>

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>

<html xmlns=”http://www.w3.org/1999/xhtml”>

<head runat=”server”>

    <title>Untitled
Page</title>

</head>

<body>

    <form id=”form1″ runat=”server”>

        <div>

            <table width=”100%”>

                <tr>

                    <td colspan=”2″ align=”center”>

                        Book application</td>

                </tr>

                <tr>

                    <td width=”10%”>

                        Right menu

                    </td>

                    <td>

                        <asp:ContentPlaceHolder ID=”ContentPlaceHolder1″ runat=”server”>

                        </asp:ContentPlaceHolder>

                    </td>

                </tr>

            </table>

        </div>

    </form>

</body>

</html>

 

 

 

Now the list page.

Add a new Item – Web
Form(frmPublisherList.aspx) – and make sure that you have checked BOTH
checkboxes. The next dialog shows you the BookMaster that you must select and
then press OK.Right click on the file and choose “Set as start page”

In the asp:content tag
drag a gridview ( found in Toolbox=> Data) .

This gridview must be
filled with data – so we will connect to the objects that we have created. Here
is a problem – how we can found if we create for the dll a Debug or Release and
bind to the apropiate folder ? The solution, as always in programming, is
indirection : make a new folder , bookdll and we will copy here the sources,
independently of debug or release.

So we create the
C:\Book\BookDll , go back to the Book solution and on Build Events copy the
sources in the BookDll folder and put this line in the      Post build command line:

copy
$(TargetDir)*.*  $(ProjectDir)..\BookDll
/Y

Compile the project.

Now you will find in
the C:\Book\BookDll folder the BookObjects.dll

Add a reference to the
BookObjects.dll in the BookWeb application( old story : right click http://localhost/BookWeb project, choose
add reference, click Browse tab – and navigate to the C:\Book\BookDll folder.

 

On the frmPublisherList.aspx
press F7 and put this lines into the Page_load event

if (!IsPostBack)

            BindData();

 

The BindData function:

private void
BindData()

    {

        BookObjects.ColPublisher
publishers = new BookObjects.ColPublisher();

        publishers.Load();

        grdPublisher.DataSource = publishers;

        grdPublisher.DataBind();// main difference ASP and Windows forms – this call

    }

 

 

Now
, if you run the project, an error will occur
: Object reference not set to an instance of an object

This is because we do
not add yet the web.config with database connection.add a new web configuration
file ,named default Web.Config, and in the connection strings put this:

<connectionStrings>

    <add name=“SQLServer“ connectionString=“server=.;Trusted_Connection=true;database=Book;“/>

  </connectionStrings>

And we must specify
that we connect to the SQL .

<appSettings>

    <add key=“DatabaseUsed“ value=“SQLServer“/>

    <!– possible values : MDB, SQLServer–>

  </appSettings>

 

 

Now press again
CTRL+F5.  The error that you have now is

Cannot open database “Book” requested by the
login. The login failed.
Login failed for user ‘<PCNAME>\ASPNET’.

Why
this error? Remember that we have put
Trusted_Connection=true
in
the web.config. So the user that is connecting is the user that runs the site.

We
have more solutions :

1)      Use in the
web.config a connection with user name and password (good for Internet sites)

2)      Run the
site on other credentials for anonymous( good for internet/intranet sites) –
option made in IIS like in image

3)      Disable
anonymous and use “Integrated windows” 
in collaboration with a setting in web.config file,
<identity
impersonate=“true“/>( good for
intranet
sites )

4)      Create a
SQL Server user for the credentials user(IUSR_ )that has rights on the
database.

You
can make your choice…Personally, I prefer the first solution.

OK.The
next time we will see how to insert data on the SQL database.


 

 

           

Recommended Readings

Master Pages

ConnectionStrings

chinuiala la configurare NAT

M-am chinuit de am turbat: am vrut sa cofigurez NAT pentru un W2003 Server(2 placi de retea-una interna si una de internet) si un laptop.
De mult nu m-am mai luptat cu asta… si uitasem cum se face….
Teoretic, ar fi trebuit sa fie simplu, ca aici sau aici
Practic, nu mi-a mers(daca puneam totul pe DHCP se plingea ca nu i se da adresa de retea- desi ipconfig /all mergea -iar ping-ul de la server la laptop mergea – invers nu (!?))

Pina la urma am pus adresa statica la laptop (192.168.0.1 ) si la DHCP 102.168.0.3 si s-au vazut intre ele, am facut wizard-ul de la Routing and Remote Access – usor de completat si apoi la DNS pentru laptop am pus DNS de la provider-ul de internet ( care face si autentificare MAC- altfel mutam cablul )-si gata! (probabil ceva incorect configurat la DNS? – sa nu mearga fara Active Directory? Sau alta sa fie cauza?)

Iar singura smecherie pe care am re-invatat-o este :
netsh -c interface dump > c:\location1.txt  – salvare setari network
netsh -f c:\location1.txt  – restaurare

Dilema veche si Mall-urile

Am asteptat cu nerabdare Dilema- si, desi a inceput mai greu, nu m-a dezamagit pina la urma

Magdalena Boiangiu despre contrabanda si despre politia care pazeste contrabandistii

Cioroianu
despre dezamagire – i-as spune ca dictatura banului este cea mai tare
din oricare dintre dictaturi – nu te impinge nimeni sa mai pui o haina
pe tine-  inchizi caloriferul si o faci singur sa nu platesti o suma
mai mare

Andrei Codrescu – despre Iran si un paragraf memorabil
dilematic:”Stinga ignora miscarea democratica din Iran, asa cum a
ignorat si miscarile democratice din Europa de Est, care au dus la
caderea acelor regimuri tiranice.Dreapta face uz de retorica pentru
a-si argumenta optiunea pentru razboi”.

Constanta
Vintila-Ghitulescu dezvolta uimitor de bine pasiunea ei pentru trecut
intr-un articol super despre evolutia imbracamintii la boieri

De la Vintila Mihailescu am aflat ca sunt in ton cu lumea- doar am fost in Piata sa vad artificiile

Alexandru
Calinescu face recenzia unei carti critice la adresa Derride, Foucault,
Bourdieu -dar mi-a placut fraza lui Bourdieu(fara legatura cu
realitatea, dar cu atit mai savuroasa):
“diferentele vizibile intre organele sexuale masculin si feminin sunt o constructie sociala”

Marius Chivu face apologia Mall-ului  (dar il si critica )in Argumentul de pe pagina 9

Lui
Bogdan Voicu i-as argumenta ca Mall-ul stimuleaza si lectura. Sunt un
regulat vizitator al mall-ului din Dr Taberei, unde ma duc deseori cu
copilul in zilele urite / ploioase. Acolo mergem la Diverta
– citim, ne jucam.Am observat ca tot timpul fotoliile sunt pline… si
oamenii nu citesc ziare- ci carti. E o biblioteca publica mai
atragatoare- si cu materiale “la zi”

De la Cristi Neagoe ramin cu ideea ca trebuie NEAPARAT sa ajung la Iulius Mall

“Cel mai bun film romanesc din 2007” au fost 2 sau 3: “a fost sau n-a fost ” “albastru” “sfirsitul lumii”

Andrei Gorzo- despre “Apocalypto”- si cum contrasteaza cu Kill Bill si Sin City- care “separa violenta de suferinta”

Radu
Cosasu, in verva ca in timpurile bune, despre “megalomania salveaza
Romania” si despre durerile de dinti la dusmani si multe altele. De
citit NEAPARAT!

Lucian Popescu despre un nou fel de piata (dupa
George A. Akerlof) si aplicarea ei la ziarele din RO. Descriere:Piata
in care cumparatorul are mai putine informatii despre calitatea unui
produs decit vinzatorul.
Acest tip de piata duce la stimularea
vinzatorului sa ofere produse proaste la un pret mic- pina cind fie
piata dispare, fie reapar produsele de calitate-din cauza faptului ca
nu se mai gasesc cumparatori

Cristi Luca despre Pasolini – alt cineast din care nu am vazut nimic -si se pare ca am pierdut destul.

De asemenea mai are si un supliment in care dna Mungiu este precisa, taioasa si bine intentionata- dar nu stiu care este efectul

O dilema de citit linistit in cadrul unei seri placute!

sin city la HBO

exact cum spunea Gorzo in Dilema veche – separa violenta de suferinta.
Modul de realizare alb-negru cu pete de culoare rosu-galbena-albastru nu a fost atit de spectaculos pe cit imi inchipuiam
Iar povestirile, in ciuda a ceea ce vor sa faca, SUNT disparate- si mai bine le lasau asa

LINQ si linkuri

Dupa discutia de pe RONUA, in care Alex recomanda citirea http://blogs.msdn.com/ericwhite/pages/FP-Tutorial.aspx , am incercat sa pricep.

Tot RONUA mi-a fost de folos, Cryogenic si Alex recomandindu-mi 2 video-uri:
http://channel9.msdn.com/showpost.aspx?postid=114680.
http://channel9.msdn.com/ShowPost.aspx?PostID=236745#236745
( de vizualizat in ordinea asta – chiar daca se repeta)

Iar daca nu stiti (aproape) nimic despre FP( functional programming), Stalker mi-a trimis un link super bun:
http://www.defmacro.org/ramblings/fp.html

Multumesc tuturor!

glume de vineri seara

We do what we must, and call it by the best names.
  – Ralph Waldo Emerson

By all means marry; if you get a good wife, you’ll be happy. If you get a bad one, you’ll become a philosopher.
  – Socrates

Femeile cred ca daca o pisica fuge de acasa este din cauza lipsei de afectiune oferite.
– Femeile cred ca daca un caine fuge de acasa este din cauza lipsei de afectiune oferite.
– Femeile cred ca daca o femeie fuge de acasa este din cauza lipsei de afectiune oferite.
– Femeile cred ca daca un barbat fuge de acasa este din cauza ca barbatii sunt porci.

truman capote si mic dejun la tiffany

Am luat Cotidianul de ieri- pentru ca, in general, nu imi place sa vad un film facut dupa o carte fara sa incerc sa o citesc.
Mi-a confirmat parerea : o c[]va nu atit desteapta, cit dezinvolta… si plina de succes din cauza asta .
Iar ca model de scriere- m-a dezamagit.
De ne – recomandat

M-am distrat la rubrica de Linux din Catavencu

Sa citez din articolul lui Dragos:
“Cel mai mare atu al OpenSuse este utilitarul de management al sistemului, Yast”( incepem bine… deci un ATU al OpenSuse … nu o scula obisnuita). Dar sa citim( citam) mai departe
“Acesta permite instalarea, configurarea si administrarea pachetelor software”( deja o functionalitate avansata…)
“Practic, prin intermediul unei interfete grafice se poate administra integral, centralizat, atit sistemul de operare, cit si aplicatiile care ruleaza sub acesta.Pentru cei deja experimentati, obisnuiti cu editarea fisierelor de configurare sub Linux, Yast poate deveni extrem de iritant, deoarece nu se impaca foarte bine cu modificarile manuale” – In lumea Windows, am spune fie ca programul nu ia in considerare toate optiunile, fie ca e plin de bug-uri. Oricum, nu isi face treaba decit la un minim necesar … dar e un ATU .

Asa ca va urez, dupa cum zice Dragos la final, “Mult succes!” – la configurari