我想我正在敲打我的头脑比我应该做的更多.我有这个简单的查询:
SELECT * FROM opening_hours WHERE day_id = 3 OR day_id IS NULL
Run Code Online (Sandbox Code Playgroud)
这将为我提供在day_id列中同时具有3和NULL的所有行,并且如果找不到3,它将仅给出具有NULL的行.如果找到3,如何禁止具有NULL的行,如果找不到3则如果给出带NULL的行?
有没有办法在一个查询中执行此操作?我也尝试过XOR,它只会给我找到3的行,但如果没有则没有.
我在中阅读了xsd和xml文件DataSet,现在我想从中创建数据库DataSet
foreach (DataTable dt in temp.Tables) {
foreach (DataColumn dc in dt.Columns) {
//example for one column
SqlCommand createtable = new SqlCommand(
"create table " + dt.TableName + " ("
+ dc.ColumnName + " varchar(max))", conn);
createtable.ExecuteNonQuery();
}
}
Run Code Online (Sandbox Code Playgroud)
但是我有一些问题,当我创建数据库表时,我需要XSD的列类型和大小(例如use varchar(max))。如何解决这个问题?
例如在xsd中,我有
<xs:restriction base="xs:string">
<xs:maxLength value="36"/>
<xs:minLength value="1"/>
</xs:restriction>
Run Code Online (Sandbox Code Playgroud)
要么
<xs:restriction base="xs:string">
<xs:maxLength value="40"/>
</xs:restriction>
Run Code Online (Sandbox Code Playgroud)
要么
<xs:restriction base="xs:decimal">
<xs:totalDigits value="19"/>
<xs:fractionDigits value="2"/>
</xs:restriction>
Run Code Online (Sandbox Code Playgroud)
最后,我需要脚本来创建具有列大小的数据库表(例如在xsd中)
UPD:也许用于XmlSchemaSet解析XSD?
首先,我想提一下,我在java中并没有真正的经验,我搜索了StackOverFlow来解决我的问题,要么我没有找到它或者没有理解答案,所以我现在要问:
我想开始使用BufferedReader,并没有找到任何我理解的指南,所以我从这里和那里拿到了一些并写了这个例子:
BufferedReader input = new BufferedReader (new InputStreamReader (System.in));
int x = Integer.parseInt(input.readLine());
String y = input.readLine();
System.out.println(x);
Run Code Online (Sandbox Code Playgroud)
这个代码工作的输入34,然后再进入abc,但在什么即时试图达到我需要的输入34 abc通过空间分隔开,以inputed在一起,并且x将得到34和y将得到abc.这在使用扫描仪时会起作用,但问题是扫描仪超时我正在做的练习因为它很慢.
是否有任何简单的方法可以将这些输入空间分开,就像使用Scanner一样?
嗨,我必须匹配下面的模式
{digit 0-1 or A}:{digit 0-1 or A}:{digit 0-1 or A}|{digit 0-1 or A}:{digit 0-1 or A}:{digit 0-1 or A}|{digit 0-1 or A}:{digit 0-1 or A}:{digit 0-1 or A}
Run Code Online (Sandbox Code Playgroud)
我使用以下代码 -
String accMatrixPattern = "\\d{1,1}|[A]:\\d{1,1}|[A]:\\d{1,1}|[A]|[A]:\\d{1,1}|[A]";
String accMatrx = "1:A:1|0:1:1|0:1:1";
Run Code Online (Sandbox Code Playgroud)
如果我只使用" \\d{1,1}|[A]"; 它工作但没有结合.
请建议如何匹配正则表达式
谢谢
我必须如下SQL Server 2008表
表A.
ID int Not Null (primary ID)
No int NULL
Value int NULL
Flag nchar(10) NULL
Run Code Online (Sandbox Code Playgroud)
表B.
ID int Not Null (primary ID)
No int NULL
Value int NULL
Flag nchar(10) NULL
Run Code Online (Sandbox Code Playgroud)
我在表A中有以下数据
ID No Value Flag
1 1 12 1
2 1 12 1
3 1 25 1
4 2 120 1
5 3 36 2
6 2 120 2
7 6 1 1
8 2 10 1
9 6 10 2
10 1 25 2 …Run Code Online (Sandbox Code Playgroud) Main.dbName = "7202"
query = "select * into " + Main.dbName + ".dbo.[AccountReceivableHistory]
from " + dbOrigin + ".dbo.[AccountReceivableHistory] where
AccountReceivableHistory].Date >= '2012-12-27' and
AccountReceivableHistory].Date < '2012-12-28'"
Run Code Online (Sandbox Code Playgroud)
错误说
'7202'附近的语法错误.
我正在设计一个Toggle Switch控件CheckBox,但是目前我的控件只画了一个圆圈.如何绘制如下图像的圆形图形,如何根据控件的值更改圆的位置以表示已检查和未检查的状态,如下图所示:
这是我的代码:
public class MyCheckBox:CheckBox
{
public MyCheckBox()
{
this.Appearance = System.Windows.Forms.Appearance.Button;
this.BackColor = Color.Transparent;
this.TextAlign = ContentAlignment.MiddleCenter;
this.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.FlatAppearance.BorderColor = Color.RoyalBlue;
this.FlatAppearance.BorderSize = 2;
}
protected override void OnPaint(PaintEventArgs e)
{
this.OnPaintBackground(e);
using (var path = new GraphicsPath())
{
var c = e.Graphics.ClipBounds;
var r = this.ClientRectangle;
r.Inflate(-FlatAppearance.BorderSize, -FlatAppearance.BorderSize);
path.AddEllipse(r);
e.Graphics.SetClip(path);
base.OnPaint(e);
e.Graphics.SetClip(c);
e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
if (this.Checked)
{
using (var p = new Pen(FlatAppearance.BorderColor,
FlatAppearance.BorderSize))
{
e.Graphics.DrawEllipse(p, r);
}
}
}
}
}
Run Code Online (Sandbox Code Playgroud) 我正在使用C#中的线程.以下是我正在使用的代码
// worker thread
Thread m_WorkerThread;
// events used to stop worker thread
ManualResetEvent m_EventStopThread;
ManualResetEvent m_EventThreadStopped;
private void btnSend_Click(object sender, EventArgs e)
{
if (btnSend.Text == "Cancel")
{
StopThread();
btnSend.Text = "Send";
return;
}
else
{
// initialize events
m_EventStopThread = new ManualResetEvent(false);
m_EventThreadStopped = new ManualResetEvent(false);
btnSend.Text = "Cancel";
// reset events
m_EventStopThread.Reset();
m_EventThreadStopped.Reset();
// create worker thread instance
m_WorkerThread = new Thread(new ThreadStart(this.ThreadFunction));
m_WorkerThread.Name = "Thread Sample"; // looks nice in Output window
m_WorkerThread.Start();
}
}
private …Run Code Online (Sandbox Code Playgroud) 我试图根据下面的角色查询表格,但我收到这样的错误
'='附近的语法不正确.
我不知道为什么我会收到这个错误
下面是我的查询
CREATE procedure [dbo].[getName]
@AccountId int,
@role varchar(50),
@Activated_By nvarchar(100)
AS
BEGIN
SELECT Name
FROM pass_activationinfo
WHERE
CASE WHEN @role = 'Admin'
THEN account_id = @AccountId
ELSE Activated_By = @Activated_By
END
END
Run Code Online (Sandbox Code Playgroud) 这是两个表: 输入:
Employees table:
+-------------+----------+
| employee_id | name |
+-------------+----------+
| 2 | Crew |
| 4 | Haven |
| 5 | Kristian |
+-------------+----------+
Salaries table:
+-------------+--------+
| employee_id | salary |
+-------------+--------+
| 5 | 76071 |
| 1 | 22517 |
| 4 | 63539 |
+-------------+--------+
Run Code Online (Sandbox Code Playgroud)
我想要一个像你如何执行连接但使用联合的输出。
联合的输出应如下所示:
employee_id | name | salary
2 crew. null
4. haven. 63539
5. Kristian 76071
1. null. 22517
Run Code Online (Sandbox Code Playgroud)
并发布工会我想执行选择,通过选择没有姓名或没有薪水的员工的employee_id
目前我正在处理的查询:
select * from
(select employee_id, name, null …Run Code Online (Sandbox Code Playgroud)