Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

Ö´ÐÐSQLÎÄ£¬Éú³ÉEXCEL

''' <summary>
''' SQLÎÄ執ÐÐ結¹û¤ÎEXCEL³öÁ¦
''' </summary>
''' <param name="connString">OLEDB½Ó続ÎÄ×ÖÁÐ</param>
''' <param name="sqlString">SQLÎÄ</param>
''' <param name="savePath">³öÁ¦¥Õ¥¡¥¤¥ë¥Ñ¥¹</param>
''' <remarks></remarks>
Public Shared Sub ExecSqlToExcel(ByVal connString As String, ByVal sqlString As String, _
ByVal savePath As String)
Dim mExcelApplication As Excel.Application = Nothing
Dim mWorkbook As Excel.Workbook = Nothing
Dim mWorkSheet As Excel.Worksheet = Nothing
Dim mQueryTable As Excel.QueryTable = Nothing
Try
mExcelApplication = New Excel.Application()
mWorkbook = mExcelApplication.Workbooks.Add
mWorkSheet = mWorkbook.Sheets(1)
mQueryTable = mWorkSheet.QueryTables.Add(connString, mWorkSheet.Range("A1"), sqlString)
mQueryTable.FieldNames = True
mExcelApplication.DisplayAlerts = False
mQueryTable.Refresh()
mWorkbook.SaveAs(savePath)
Catch ex As Exception
Throw ex
Finally
If Not mWorkSheet Is Nothing Then
mQueryTable = Nothing
mWorkbook.Close()
mWorkbook = Nothing
mExcelApplication = Nothing
End If
End Try
End Sub
˵Ã÷£º
connString="OLEDB;Provider=SQLOLEDB;server=xxx;uid=xxx;pwd=xxx;Initial Catalog=xxx"
savePathÓ¦¸ÃÊÇÍêÕûµÄ·¾¶£¨º¬ÎļþÃû£©
µ¼³öµÄexcelûÓиñʽҪÇó£¬Èç¹ûÓбØÒª£¬¿ÉÒÔͨ¹ývba¶Ô¸Ã¶ÔÏó½øÐиñʽ²Ù×÷
µÚÒ»ÐÐÊÇselectµÄ×Ö¶ÎÃû£¬Èç¹ûÏëÒªºº×ÖÐÎʽ£¬Ôò¸øÿ¸ö×ֶμÓÉϺº×Ö±ðÃû¼´¿É


Ïà¹ØÎĵµ£º

½â¾öSQL ServerתACCESS×Ô¶¯±àºÅÎÊÌâ


1.´ò¿ªSQL server enterprise mananger “ÆóÒµ¹ÜÀíÆ÷”
ÔÚÄãÒªµ¼³öµÄSQLÊý¾Ý¿âÉÏÊó±êÓÒ¼ü²Ëµ¥£ºËùÓÐÈÎÎñ-¡·µ¼³öÊý¾Ý
2.»Ø³öÏÖÒ»¸öµ¼³öÏòµ¼´°¿Ú¡£
Ñ¡Ôñ±»µ¼³öµÄÊý¾ÝÔ´£¬ÎªÄã¸Õ²ÅËùÑ¡ÔñµÄÊý¾Ý¿â£¬Èç¹û·¢ÏÖ²»¶ÔÓ¦×ÔÐÐÐ޸ġ£
3.½øÈëµ¼³öµ½Ä¿±êÊý¾ÝÔ´µÄÑ¡Ôñ£¬ÕâÀïÎÒÃÇҪת³ÉACCESSµÄÊý¾Ý¿â¡£×¢ÒâÑ¡ÔñÊý¾ÝÔ´ÀàÐÍÎ ......

[ÊÕ£] ÓÃsqlite Ö´Ðбê×¼ sql Óï·¨

http://www.umgr.com/blog/PostView.aspx?bpId=36294
 1. Ö´ÐÐsqlÓï¾ä
int sqlite3_exec(sqlite3*£¬ const char *sql£¬ sqlite3_callbacksql Óï·¨
£¬ void *£¬  char **errmsg );
Õâ¾ÍÊÇÖ´ÐÐÒ»Ìõ sql Óï¾äµÄº¯Êý¡£
µÚ1¸ö²ÎÊý²»ÔÙ˵ÁË£¬ÊÇÇ°Ãæopenº¯ÊýµÃµ½µÄÖ¸Õ롣˵ÁËÊǹؼüÊý¾Ý½á¹¹¡£
µÚ2¸ö²ÎÊýconst char ......

ÖØбàÒëËùÓÐÎÞЧµÄPL/SQLÄ£¿é£¨¶ÔÏó£©

µ±OracleÊý¾Ý¿â´´½¨Íê³Éºó£¬ÏµÍ³½«»á×Ô¶¯ÔËÐÐutlrp.sqlÕâ¸ö½Å±¾Îļþ£¨D:\oracle\product\10.1.0\Db_1\RDBMS\ADMIN£©£¬µ«ÊÇ£¬µ±Í¨¹ý¶¨ÖÆ°²×°ÀàÐ͵ķ½Ê½´´½¨ÁËÊý¾Ý¿âʱ£¬ÏµÍ³Ôò²»»áÔËÐÐutlrp.sqlÕâ¸ö½Å±¾£¬ËùÒÔ£¬½¨ÒéÔÚ´´½¨¡¢¸üлòǨÒÆÒ»¸öÊý¾Ý¿âºó£¬ÔËÐÐÒ»ÏÂutlrp.sqlÕâ¸ö½Å±¾£¬ÒÔÑéÖ¤Êý¾Ý¿â°²×°ÊÇ·ñ³É¹¦£¬ÕâÑù¿ÉÒÔÖØбàÒë ......

AccessÊý¾Ý¿â×Ö¶ÎÀàÐÍ˵Ã÷ÒÔ¼°ÓëSQLÖ®¼äµÄ¶ÔÕÕ¹Øϵ

Îı¾ nvarchar(n)
±¸×¢ ntext
Êý×Ö(³¤ÕûÐÍ) int
Êý×Ö(ÕûÐÍ) smallint
Êý×Ö(µ¥¾«¶È) real
Êý×Ö(Ë«¾«¶È) float
Êý×Ö(×Ö½Ú) tinyint
»õ±Ò money
ÈÕÆÚ smalldatetime
²¼¶û bit
¸½£º×ª»»³ÉSQLµÄ½Å±¾¡£
ALTER TABLE tb ALTER COLUMN aa Byte Êý×Ö[×Ö½Ú]
ALTER TABLE tb ALTER COLUMN aa Long Êý×Ö[³¤ÕûÐÍ]
ALTER T ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ