c#sql server
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using AHUT_TetWebERP;
/// <summary>
/// DataBase µÄժҪ˵Ã÷
/// </summary>
public class DataBase
{
SqlConnection conn = null;
SqlDataAdapter adapter = null;
SqlCommand command = null;
SqlDataReader reader = null;
DataSet ds = null;
public DataBase()
{
//
// TODO: ÔÚ´Ë´¦Ìí¼Ó¹¹Ô캯ÊýÂß¼
//
}
/// <summary>
/// Êý¾Ý¿âÁ¬½Ó
/// </summary>
public void connection()
{
conn = new SqlConnection(ConfigurationManager.ConnectionStrings["BWConnectionString"].ToString());
conn.Open();
}
/// <summary>
/// ¹Ø±ÕÊý¾Ý¿âÁ¬½Ó
/// </summary>
public void CloseConnection()
{
if (conn != null)
conn.Close();
}
/// <summary>
/// ·µ»ØÊý¾Ý¼Ç¼¼¯DataSet
/// <param name="sql">ÊÊÅäÆ÷µÄÊý¾Ý²éѯÓï¾ä</param>
/// </summary>
public DataSet returnRecordset(string sql)
{
try
{
adapter = new SqlDataAdapter(sql, conn);
ds = new DataSet();
adapter.Fill(ds);
&nbs
Ïà¹ØÎĵµ£º
SELECT CONVERT(varchar(100), CAST(@testFloat AS decimal(38,2)))
SELECT STR(@testFloat, 38, 2)
´ÓExcelÖе¼Èëµ½sql2000£¬ÓÐÒ»ÁГÁªÏµ·½Ê½”±ä³ÉÁËfloatÀàÐÍ£¬ÎÒÏëת»»³ÉnvarcharÀàÐÍ£¬ÓÃÏÂÃæµÄÓï¾ä
select convert(nvarchar(30),convert(int,ÁªÏµ·½Ê½)) from employee
go
//Êý¾ÝÒç³ö£¬²»ÐУ¡
select ......
JAVA£×Ö·û´®¹ýÂËÀà
package cn.com.hbivt.util;
/**
* Title:
*
* Description:
*
* Copyright: Copyright (c) 2005
*
* Company:
*
* @author not attributable
* @version 1.0
*/
public class StringUtils {
......
ÔÚAsp.netÖУ¬´ÓAÒ³ÃæÖе¯³öBÒ³Ã棬ÔÚBÒ³ÃæÖÐÑ¡ÔñÊý¾Ýºó£¬¹Ø±Õ²¢½«Êý¾Ý¸üе½AÒ³Ã棬ÊÇÒ»ÖÖ³£Óõķ½Ê½¡£Ö»ÊÇÎÒ¶ÔJavascript²»ÊìϤ£¬ËùÒÔµ·¹ÄÁËÒ»ÏÂÎ磬ÖÕÓÚÓÐÁËÒ»µã³É¼¨¡£
¡¡¡¡²âÊÔÏîÄ¿ÓÐÁ½¸öÒ³Ã棺Default.aspx¼°Default2.aspx£¬ÔÚDefault.aspxÒ³ÃæÉÏÓÐÒ»¸öTextBox1¼°Ò»¸öButton1£¬Button1ÓÃÓÚ´¥·¢Default2.aspx£¬TextBox ......
ÒªÔÚSQL ServerÊý¾Ý¿âÖд洢m³²¢´òÓ¡³öÀ´, ·½·¨ÈçÏ£º
1£©½«Êý¾Ý¿âÖÐÏàÓ¦×ֶεÄÊý¾ÝÀàÐÍÉèΪnchar»ònvarcharÀàÐÍ¡£
2£©´ÓExcelÖеõ½m³£¬¸´ÖÆÕ³Ìùµ½½ÓÊÕÊý¾ÝµÄ¿Ø¼þÖУ¨TextBox¡¢DataGridViewµÈ£©¡£±£´æ¼´¿É¡£
×¢£º1£©nchar,nvarcharÓëchar,varcharµ ......
ÏÂÁÐÓï¾ä²¿·ÖÊÇMssqlÓï¾ä£¬²»¿ÉÒÔÔÚaccessÖÐʹÓá£
SQL·ÖÀࣺ
DDL—Êý¾Ý¶¨ÒåÓïÑÔ(CREATE£¬ALTER£¬DROP£¬DECLARE)
DML—Êý¾Ý²Ù×ÝÓïÑÔ(SELECT£¬DELETE£¬UPDATE£¬INSERT)
DCL—Êý¾Ý¿ØÖÆÓïÑÔ(GRANT£¬REVOKE£¬COMMIT£¬ROLLBACK)
Ê×ÏÈ,¼òÒª½éÉÜ»ù´¡Óï¾ä£º
1¡¢ËµÃ÷£º´´½¨Êý¾Ý¿â
CREATE DATABASE data ......