不過我們可以透過以下方法達到相同的效果
...
var obj = from t in ctx.test_T
orderby Guid.NewGuild()
select t
...
參考網站 : Linq To Sql 如何替代 newid()
...
var obj = from t in ctx.test_T
orderby Guid.NewGuild()
select t
...
# MySQL Setting datasource.mysql.driverClassName=com.mysql.jdbc.Driver datasource.mysql.dialect=org.hibernate.dialect.MySQLDialect datasource.mysql.demowebdb.url=jdbc:mysql://localhost:3306/demowebdb?useUnicode=true&characterEncoding=UTF-8 datasource.mysql.demowebdb.username=xxxxx datasource.mysql.demowebdb.password=xxxxx ...d. 開啟 WEB-INF\spring\appServlet\servlet-context.xml 檔, 更改
...
<beans:bean class="com.mchange.v2.c3p0.ComboPooledDataSource" id="dataSource">
<beans:property name="driverClass" value="${datasource.sqlite.driverClassName}"/>
<beans:property name="jdbcUrl" value="${datasource.sqlite.demowebdb.url}"/>
<beans:property name="user" value="${datasource.sqlite.demowebdb.username}"/>
<beans:property name="password" value="${datasource.sqlite.demowebdb.password}"/>
</beans:bean>
...
修改成...
<beans:bean class="com.mchange.v2.c3p0.ComboPooledDataSource" id="dataSource">
<beans:property name="driverClass" value="${datasource.mysql.driverClassName}"/>
<beans:property name="jdbcUrl" value="${datasource.mysql.demowebdb.url}"/>
<beans:property name="user" value="${datasource.mysql.demowebdb.username}"/>
<beans:property name="password" value="${datasource.mysql.demowebdb.password}"/>
</beans:bean>
...
>>> import pickle
>>> x = {'name':'allen', 'sex':'boy'}
>>> xs = pickle.dumps(x)
>>> xs
"(dp0\nS'name'\np1\nS'allen'\np2\nsS'sex'\np3\nS'boy'\np4\ns."
>>> xsa = pickle.loads(xs)
>>> xsa
{'name': 'allen', 'sex': 'boy'}
>>> import pickle
>>> x = {'name':'allen', 'sex':'boy'}
>>> f = open('c:/pyreadfile.txt', 'wb')
>>> pickle.dump(x, f)
>>> f.close()
>>> f = open('c:/pyreadfile.txt', 'rb')
>>> a = pickle.load(f)
>>> f.close()
>>> print a
{'name': 'allen', 'sex': 'boy'}
>>> import MySQLdb
>>> db = MySQLdb.connect(host="localhost", user="xxxx", passwd="xxxx", db="xxxx")
>>> cursor = db.cursor()
>>> cursor.execute("select * from system_user")
2L
>>> result = cursor.fetchall()
>>> for record in result :
print record[0]
USERE00000000000000000001
USERE00000000000000000002
>>>
String url = "jdbc:sqlite://C:\\test.db";
try {
Class.forName("org.sqlite.JDBC");
Connection con = DriverManager.getConnection(url);
String query = "select * from test_T";
Statement stmt = con.createStatement();
con = DriverManager.getConnection(url);
ResultSet rs = stmt.executeQuery(query);
while (rs.next()) {
out.print(rs.getString("Id")+" "+rs.getString("Password")+"<br/>");
}
rs.close();
stmt.close();
} catch (Exception e) {
e.printStackTrace();
out.print(e.getMessage());
}
import java.sql.Connection; import java.sql.*; import org.sqlite.JDBC;