我需要一个解决方案.我想从一个表中减去/添加一个字段值与另一个表.我正在提供细节.
我有两张桌子(相同的结构).
表1 - purchase 字段:id, purchase_from, product_name, quantity, rate
表2 - sales 字段:id, sale_to, product_name, quantity, rate
现在我想从purchase表到sales表中减去数量,并将数据显示到datagridview中.
我试过了,但都失败了.我给你的代码片段.
Dim PurchasePrdName, SalesPrdName As String
Dim PurchaseQty, SalesQty As Double
Private Sub LoadPurchase()
Try
OpenConnection()
Dim dcommand As New MySqlCommand
Dim qry As String = "SELECT ProductName,SUM(Quantity) FROM stockitems GROUP BY ProductId"
dcommand.Connection = conn
dcommand.CommandText = qry
Dim dbread As MySqlDataReader = dcommand.ExecuteReader
DataGridView1.Rows.Clear()
While dbread.Read
If dbread.HasRows Then
PurchasePrdName = dbread("ProductName").ToString
PurchaseQty …Run Code Online (Sandbox Code Playgroud) 使用 Excel 2010、Visual Studio Express 2013。
我在 Visual Studio 中为 Microsoft Excel 14.0 添加了参考对象库
Imports Microsoft.Office.Core
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim oXL As Excel.Application
Dim oWB As Excel.Workbook
Dim oSheet As Excel.Worksheet
Dim oRng As Excel.Range
' Start Excel and get Application object.
oXL = CreateObject("Excel.Application")
oXL.Visible = True
End Sub
End Class
Run Code Online (Sandbox Code Playgroud)
但是它给了我以下错误:
未定义类型“Excel.Application”。
未定义类型“Excel.Workbook”。
未定义类型“Excel.Worksheet”。
未定义类型“Excel.Range”。
如果我为 excel 版本使用了错误的参考库,请说明如何将正确的对象库添加到列表中。
尝试将文件从路径A阴影复制到路径B,但它不断抛出错误消息
{“无法加载文件或程序集'AlphaVSS.x64,版本= 1.4.0.0,文化=中性,PublicKeyToken = 959d3993561034e3'或其依赖项之一。尝试加载格式错误的程序。”}
我尝试的代码
Public Sub copyFile(baza As String, destination As String)
If IO.File.Exists(baza) Then
Dim myFileInfo As FileInfo
myFileInfo = New FileInfo(baza)
Dim _volume As String = myFileInfo.Directory.Root.Name
Dim _vssImplementation As IVssImplementation = VssUtils.LoadImplementation()
Dim _backup As IVssBackupComponents = _vssImplementation.CreateVssBackupComponents()
_backup.InitializeForBackup(Nothing)
_backup.GatherWriterMetadata()
_backup.SetContext(VssVolumeSnapshotAttributes.Persistent Or VssVolumeSnapshotAttributes.NoAutoRelease)
_backup.SetBackupState(False, True, Alphaleonis.Win32.Vss.VssBackupType.Full, False)
Dim MyGuid01 As Guid = _backup.StartSnapshotSet()
Dim MyGuid02 As Guid = _backup.AddToSnapshotSet(_volume, Guid.Empty)
_backup.PrepareForBackup()
_backup.DoSnapshotSet()
_backup.ExposeSnapshot(MyGuid02, Nothing, VssVolumeSnapshotAttributes.ExposedLocally, "L:")
Dim sVSSFile2 As String = baza.Replace(_volume, "L:\")
If (File.Exists(sVSSFile2)) …Run Code Online (Sandbox Code Playgroud) 我试图获取一个类,用该类定义一个对象,然后将该对象写入 XML。看起来我可以用“公共共享”创建一个类(下面发布),创建一个由该类(字符)定义的公共共享对象,用数据填充它,然后直接将其写入 XML。我遇到了很多困难,从引用错误到创建的对象“写入”,但尽管有值,但还是空白。
我只能假设我对如何从 vb.net 编写 XML 缺乏基本的了解,尽管进行了大量研究,但我并不觉得这里更接近解决方案。
班级:
Public Class Character
Public Class CharacterStats
<XmlElement("CoreList")>
Public Shared ListCore As CoreStats
End Class
Public Class PowerList
<XmlElement("PowerList")>
Public Shared ListPowers As List(Of Power)
End Class
Public Class EdgeList
<XmlElement("EdgesList")>
Public Shared ListEdges As Edges
End Class
Public Class WeaponList
<XmlElement("WeaponList")>
Public Shared ListWeps As List(Of Weapon)
End Class
Public Class ArmorList
<XmlElement("ArmorList")>
Public Shared ListArm As List(Of Armor)
End Class
Public Class VehicleList
<XmlElement("VehicleList")>
Public Shared ListVeh As List(Of Vehicle) …Run Code Online (Sandbox Code Playgroud) 我正在开发一个客户端调查应用程序,我需要从我的服务器中获取大量的图像和ID,我以阵列格式从我们站点的rails控制台获取了我的图像.
我的代码是
<?php
$links=[[64, "https://oyo-dev.s3.amazonaws.com/uploads/hotel_image/9/photo__4_.jpg"], [63, "https://oyo-dev.s3.amazonaws.com/uploads/hotel_image/9/photo__1_.jpg"], [62, "https://oyo-dev.s3.amazonaws.com/uploads/hotel_image/9/photo__2_.jpg"], [61, "https://oyo-dev.s3.amazonaws.com/uploads/hotel_image/9/photo__7_.jpg"], [60, "https://oyo-dev.s3.amazonaws.com/uploads/hotel_image/9/photo__5_.jpg"]; //and 200 more images//
$n=(count($links));
for($i=0;$i<=$n;$i++)
{
echo $links[$i][0].'->'.$links[$i][1]."<br/>";
}
?>
Run Code Online (Sandbox Code Playgroud)
它在我的本地主机上运行很酷但是当我推送到服务器时它显示错误
"解析错误:语法错误,意外'['在第25行的/srv/disk4/1225087/www/dcvit.co.nf/survey.php"
我总是用这段代码得到一个NullPointerException
open.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
modify = true;
JFileChooser chooser = new JFileChooser();
file = chooser.getSelectedFile();
BufferedReader reader;
StringBuilder sb = new StringBuilder();
try {
reader = new BufferedReader(new FileReader(file));
String line = reader.readLine();
while(line != null) {
sb.append(line);
sb.append(System.lineSeparator());
line = reader.readLine();
}
text.setText(sb.toString());
}
catch (FileNotFoundException e1) {
e1.printStackTrace();
}
catch (IOException e1) {
e1.printStackTrace();
}
}
});
Run Code Online (Sandbox Code Playgroud)
NullPointerException就行了 reader = new BufferedReader(new FileReader(file));
我该如何重新组织我的代码?
我是VB.net的新手,我对这个语句没什么问题,我想抛出msgBox只是因为在txtBox中txtTitul不是"Bc".或""或"Ing." ...而且每次都会抛出msgBox
If Not txtTitul.Text.Equals("Bc.") _
OrElse Not txtTitul.Text.Equals("") _
OrElse Not txtTitul.Text.Equals("Bc.") _
OrElse Not txtTitul.Text.Equals("Mgr.") _
OrElse Not txtTitul.Text.Equals("Ing.") _
OrElse Not txtTitul.Text.Equals("Mgr. art.") _
OrElse Not txtTitul.Text.Equals("Ing. arch.") _
OrElse Not txtTitul.Text.Equals("MUDr.") _
OrElse Not txtTitul.Text.Equals("MVDr.") _
OrElse Not txtTitul.Text.Equals("RNDr.") _
OrElse Not txtTitul.Text.Equals("PharmDr.") _
OrElse Not txtTitul.Text.Equals("PhDr.") _
OrElse Not txtTitul.Text.Equals("JUDr.") _
OrElse Not txtTitul.Text.Equals("PaedDr.") _
OrElse Not txtTitul.Text.Equals("ThDr.") Then
MsgBox("Neplatny titul!")
Exit Sub
End If
Run Code Online (Sandbox Code Playgroud) vb.net ×5
.net ×1
arrays ×1
basic ×1
datagridview ×1
excel-2010 ×1
file ×1
if-statement ×1
java ×1
jfilechooser ×1
mysql ×1
parsing ×1
php ×1