Installation deployment of VS.NET (2) - Installation and configuration of package database

xiaoxiao2021-03-06  17

The previous installation deployment of VS.NET is just a simple packaging application, often packed in the installer together when making a installation package, and can also customize a user interface to allow users to install Enter the configuration information of the database (server name, database name, login user, password), create a database with the installer, and configure the application configuration file. Such as: Connect the string.

First, first look at an introduction to custom installations

Custom MSI installation

Second, download the program example provided above, load it directly into your own solution, you can use it. The script files you want to modify are just the script files under the script directory. (Modified to create a script you want to create), add The main output of this program is in the 'application folder' of the installer. (It is best to create two folders in this folder, bin and install, bin put your application's output file, install CustomSteps Output file)

Third. Right click on the installer item ==> View ==> User interface

Right-click 'Start' ==> Add Dialog ==> Text Box (a), moved to the second position.

Edit the properties of text box (a):

Binnertext: Database parameters

BodyText: Please configure some parameters for creating a database, each item must be filled out.

Edit1Label: Server Name:

Edit1Property: Server_Name

Edit1Value: [ComputerName]

Edit2Label: The name of the database to be created:

Edit2Property: Database_name

Edit2Value: // You can fill in a default database name, or you can not fill

Edit3Label: Username:

Edit3Property: User_name

Edit3Value: SA

Edit4Label: Password:

Edit4Property: Password

Then generate the installer ... OVER

----------------------------------

Also provide a function that automatically generates data scripts in a database

#Region Generates scripts in the data table PUBLIC STATIC STRING CREATEDAScript (String Tablename) {

Bool isidentity = false; // Is there a laser (self-increment) string commandText = String.Format ("Select C.Name, Biaoshi = ColumnProperty (C.ID, C.NAME, 'ISITENTITY'), T. Name " " from syscolumns c inner join systemypes t on c.xUsertype = T.XUSERTYPE " " where c.id = Object_ID ('{0}') ", TABLENAME);

DataTable FieldList = dbhelper.executedataTable (CommandType.text, CommandText); // This method you write if you write 吧 (FieldList == Null || FieldList.Rows.count == 0) Return ""

String getValue = string.format ("SELECT * FROM [{0}]", TABLENAME);

DataTable DT = dbhelper.executedtatable (CommandType.Text, getValue); if (DT == Null || DT.ROWS.COUNT == 0) Return "; string middle ="

For (int J = 0; j

FieldString = "[" FieldName "],"; valueString = "'" DR [FieldName] "',";} fieldstring = fieldString.Substring (0, FieldString.Length-1); valueString = valueString. Substring (0, valueString.Length-1);

Middle = string.format ("/ N INSERT INTO [{0}] ({1}) / n values ​​({2})", Tablename, FieldString, ValueString;

String script = ""; if (isidentity) script = string.format ("Set Identity_Insert [{0}] ON / N" MIDDLE "/ N / NSET Identity_INSERT [{0}] OFF" "/ n Go", Tablename, Middle); Else Script = "/ n" middle;

Return script;} #ENDREGION

2005-3-13 11:12 by cuimeteor

ASP.NET Settings IE Printing Both Act (Fine) (Turn)

The most headache in ASP.NET may be printed. For this problem, I have to be white. There are also many codes on the Internet, but there will always be some problems. According to my own actual experiment, I can't use it, and I can't find an error message such as an object. Here is two practical methods: one. Modify IE Print Setting new document </ title> <meta name = "generator" content = "adipt =" yc "> <script =" yc "> <script =" yc "> <script language = "VBScript"> dim hkey_root, hkey_path, registry address function pagesetup_null hkey_key hkey_root = "HKEY_CURRENT_USER" hkey_path = "/ Software / Microsoft / Internet Explorer / PageSetup" // IE Print settings () on error resume next set RegWsh = CreateObject ( "WScript.Shell") hkey_key = "/ header" RegWsh.RegWrite hkey_root hkey_path hkey_key, "" // header hkey_key = "/ footer" RegWsh.RegWrite hkey_root hkey_path hkey_key, "" // footer hkey_key = "/ margin_left" RegWsh.RegWrite hkey_root hkey_path hkey_key, "1" // set key - left border hkey_key = "/ margin_top" RegWsh.RegWrite hkey_root hkey_path hkey_key, "1" hkey_key = "/ Margin_right "regWsh.regWrite HKEY_ROOT HKEY_PATH HKEY_KEY," 1 "HKEY_KEY =" / margin_bottom "regWsh.regWrite HKEY_ROOT HKEY_PATH HKEY_KEY," 1 "end function '//</p> <p>function pagesetup_default () on error resume next Set RegWsh = CreateObject ( "WScript.Shell") hkey_key = "/ header" RegWsh.RegWrite hkey_root hkey_path hkey_key, "& w & b page, & p / & P" // pages -hkey_key = " / footer "RegWSH.REGWRITE HKEY_ROOT HKEY_PATH HKEY_KEY," & U & B & B & B & D "END FUNCTION </ script> </ hEAD> <body> <table width =" 100% "border = 2 Cellspacing = 1 Align = center cellpadding = 1 id = tb1> <tr> <td> <br> <br> <br> <p align = "center"> <input type = "button" value = "Clean" οnclick = "pagesetup_null () "> <infut type =" οnclick = "οnclick =" Pagesetup_default () "> <br> </ p> </ td> </ tr> </ table> </ body> </ html> In addition to There are DuplexorientationPaper_SizePaper_SourcePrinter to pay more than the above key value: The setting to the page distance is: 1, the actual setting value is 25.4. Yesterday I found this method has a fatal shortcomings. That is, this can only be valid on the machine installed with .NET framework. Because the wscript.shell it calls is .NET framework ... I thought I solved this annoying print control, yesterday's running was born in the client. Ha ha. . . . Do you want to install .NET's framework for users who don't know what .NET. Unrealistic. So can only go back to JavaScript. two. JavaScript today found that the original sometimes effective and sometimes invalid is out, <input name = "idprint" type = "value =" Print "οnclick =" DOPRINT () "> <form runat =" cannot be placed Server "ID =" Form1 ">, how do the client's JavaScript is placed in Runat Server? It's good to realize this problem.</p> <p>The following is given below: <script language = "javascript"> <! - function doprint () {// Reserved customer printer set var h = factory.printing.header; var f = factory.printing.footer; var t = Factory.printing.topmargin; var b = factory.printing.bottommargin; var l = factory.printing.L = factory.printing.printMargin; var r = factory.printing.rightmargin; document.all ("printbtn"). style.visibility = 'hidden'; // When printing, hidden print buttons // set the header foot and left and right margins Factory.Printing.Header = "Header _ Ohiolee's Print World"; factory.printing.footer = "Want to set a footer, here Oh "; factory.printing.topmargin =" 6 "; // There is a minimum default value 5.02 factory.printing.bottommargin =" 6 "; // There is a minimum default value 4.13 factory.printing.LeftMargin =" 2 "; // exist Minimum default 5.08 factory.printing.rightMargin = "2"; // There is a minimum default value 6.79. . . This is the case, I don't know if it is universal.</p></div><div class="text-center mt-3 text-grey"> 转载请注明原文地址:https://www.9cbs.com/read-45193.html</div><div class="plugin d-flex justify-content-center mt-3"></div><hr><div class="row"><div class="col-lg-12 text-muted mt-2"><i class="icon-tags mr-2"></i><span class="badge border border-secondary mr-2"><h2 class="h6 mb-0 small"><a class="text-secondary" href="tag-2.html">9cbs</a></h2></span></div></div></div></div><div class="card card-postlist border-white shadow"><div class="card-body"><div class="card-title"><div class="d-flex justify-content-between"><div><b>New Post</b>(<span class="posts">0</span>) </div><div></div></div></div><ul class="postlist list-unstyled"> </ul></div></div><div class="d-none threadlist"><input type="checkbox" name="modtid" value="45193" checked /></div></div></div></div></div><footer class="text-muted small bg-dark py-4 mt-3" id="footer"><div class="container"><div class="row"><div class="col">CopyRight © 2020 All Rights Reserved </div><div class="col text-right">Processed: <b>0.041</b>, SQL: <b>9</b></div></div></div></footer><script src="./lang/en-us/lang.js?2.2.0"></script><script src="view/js/jquery.min.js?2.2.0"></script><script src="view/js/popper.min.js?2.2.0"></script><script src="view/js/bootstrap.min.js?2.2.0"></script><script src="view/js/xiuno.js?2.2.0"></script><script src="view/js/bootstrap-plugin.js?2.2.0"></script><script src="view/js/async.min.js?2.2.0"></script><script src="view/js/form.js?2.2.0"></script><script> var debug = DEBUG = 0; var url_rewrite_on = 1; var url_path = './'; var forumarr = {"1":"Tech"}; var fid = 1; var uid = 0; var gid = 0; xn.options.water_image_url = 'view/img/water-small.png'; </script><script src="view/js/wellcms.js?2.2.0"></script><a class="scroll-to-top rounded" href="javascript:void(0);"><i class="icon-angle-up"></i></a><a class="scroll-to-bottom rounded" href="javascript:void(0);" style="display: inline;"><i class="icon-angle-down"></i></a></body></html><script> var forum_url = 'list-1.html'; var safe_token = 'tGSDVV9AzyWZA_2FNDr958yG4LnrFlmOCLxo5ssxENlV0h95pz0SaXjBS3saFCO8jedQMdUVqq_2BMHpz7aU'; var body = $('body'); body.on('submit', '#form', function() { var jthis = $(this); var jsubmit = jthis.find('#submit'); jthis.reset(); jsubmit.button('loading'); var postdata = jthis.serializeObject(); $.xpost(jthis.attr('action'), postdata, function(code, message) { if(code == 0) { location.reload(); } else { $.alert(message); jsubmit.button('reset'); } }); return false; }); function resize_image() { var jmessagelist = $('div.message'); var first_width = jmessagelist.width(); jmessagelist.each(function() { var jdiv = $(this); var maxwidth = jdiv.attr('isfirst') ? first_width : jdiv.width(); var jmessage_width = Math.min(jdiv.width(), maxwidth); jdiv.find('img, embed, iframe, video').each(function() { var jimg = $(this); var img_width = this.org_width; var img_height = this.org_height; if(!img_width) { var img_width = jimg.attr('width'); var img_height = jimg.attr('height'); this.org_width = img_width; this.org_height = img_height; } if(img_width > jmessage_width) { if(this.tagName == 'IMG') { jimg.width(jmessage_width); jimg.css('height', 'auto'); jimg.css('cursor', 'pointer'); jimg.on('click', function() { }); } else { jimg.width(jmessage_width); var height = (img_height / img_width) * jimg.width(); jimg.height(height); } } }); }); } function resize_table() { $('div.message').each(function() { var jdiv = $(this); jdiv.find('table').addClass('table').wrap('<div class="table-responsive"></div>'); }); } $(function() { resize_image(); resize_table(); $(window).on('resize', resize_image); }); var jmessage = $('#message'); jmessage.on('focus', function() {if(jmessage.t) { clearTimeout(jmessage.t); jmessage.t = null; } jmessage.css('height', '6rem'); }); jmessage.on('blur', function() {jmessage.t = setTimeout(function() { jmessage.css('height', '2.5rem');}, 1000); }); $('#nav li[data-active="fid-1"]').addClass('active'); </script>