.Net
Converting your Barcode to BarCode Text for EAN13 true font
by Bruno Rebelo on Feb.10, 2009, under .Net, C#
public string EAN13(string chaine) { int i; int first; int checksum = 0; string CodeBarre = ""; bool tableA; if (Regex.IsMatch(chaine, "^\\d{12}$")) { for (i = 1; i < 12; i += 2) { System.Diagnostics.Debug.WriteLine(chaine.Substring(i, 1)); checksum += Convert.ToInt32(chaine.Substring(i, 1)); } checksum *= 3; for (i = 0; i < 12; i += 2) { checksum += Convert.ToInt32(chaine.Substring(i, 1)); } chaine += (10 - checksum % 10) % 10; CodeBarre = chaine.Substring(0, 1) + (char)(65 + Convert.ToInt32(chaine.Substring(1, 1))); first = Convert.ToInt32(chaine.Substring(0, 1)); for (i = 2; i <= 6; i++) { tableA = false; switch (i) { case 2: if (first >= 0 && first <= 3) tableA = true; break; case 3: if (first == 0 || first == 4 || first == 7 || first == 8) tableA = true; break; case 4: if (first == 0 || first == 1 || first == 4 || first == 5 || first == 9) tableA = true; break; case 5: if (first == 0 || first == 2 || first == 5 || first == 6 || first == 7) tableA = true; break; case 6: if (first == 0 || first == 3 || first == 6 || first == 8 || first == 9) tableA = true; break; } if (tableA) CodeBarre += (char)(65 + Convert.ToInt32(chaine.Substring(i, 1))); else CodeBarre += (char)(75 + Convert.ToInt32(chaine.Substring(i, 1))); } CodeBarre += "*"; for (i = 7; i <= 12; i++) { CodeBarre += (char)(97 + Convert.ToInt32(chaine.Substring(i, 1))); } CodeBarre += "+"; } return CodeBarre; } |
Criar uma dal
by pedro on Jan.18, 2009, under .Net, C#
public class DALCON { SqlConnection connection; public DALCON() { string connectionString = ConfigurationManager.ConnectionStrings["aero"].ConnectionString; connection = new SqlConnection(connectionString); connection.Open(); } public void CloseCON() { connection.Close(); } } |
para utilizar
DALCON DalObj = new DALCON(); aux = dalobj.CloseCON; |
Connection String no Web.config
by pedro on Jan.18, 2009, under .Net, SQL
Colocar a connection string no web.config do asp.net para SQL
<connectionStrings> <add name="intranet" providerName="System.Data.SqlClient" connectionString="server=SERVER;database=database;;uid=sa;pwd=pass"/> </connectionStrings> |
