|
hoomi_ghost wrote: please complete source for download
That's not how it works.
Even if you had provided a complete and actionable specification, this is not a "write-my-code-for-me" site.
We're happy to help with specific questions about code you have written. But nobody here is going to write the code for you.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
i edited my question
thanks
|
|
|
|
|
|
You're asking for source code written in a language that's been obsolete for 16 years now.
Yeah, good luck with that.
|
|
|
|
|
Hi,
i have a question like ..suppose i have a string= "help" and I want to sort it in an alphabetically order like=ehlp . i need a code for it.
|
|
|
|
|
Sorry, but this site does not offer code writing services.
Try it yourself first. If you then got stuck, post what you have done so far and we will try to help.
Another option is searching the web. It should be no problem to find something that can be at least used as starting point.
|
|
|
|
|
thanks for your reply can you please tell me from where i can get the code
|
|
|
|
|
By using an appropriate search term entered into the input field of your favorite search engine.
If this is some kind of homework you should be aware that your teacher might read here and has done similar research to identify copy and paste solutions.
So the option of doing it yourself is probably the best (and intended!) one.
|
|
|
|
|
|
So i have a accdb name itemdb with table name Products and i want to subtract the value input in the txtbox8 to the field name RegBal
so far i have this code
Imports System.Data.OleDb
Public Class Order
Public conString As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\Landon-PC\Documents\Visual Studio 2010\Projects\Final\Final\bin\Debug\itemdb.accdb;Persist Security Info=False"
Public con As New OleDbConnection
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
con.ConnectionString = conString
If con.State = ConnectionState.Closed Then
con.Open()
MsgBox("Connected")
End If
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
Dim sqlQuery As String = "SELECT itemdb.Products, Products.RegBal, Products.RegBal- " & TextBox8.Text & "
Dim sqlCommand As New OleDbCommand
With sqlCommand
.CommandText = sqlQuery
.Connection = con
.ExecuteNonQuery()
End With
MsgBox("SAVED")
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Me.Close()
Main.Show()
End Sub
End Class
|
|
|
|
|
|
First Richard Deeming is right, do not concatenate SQL strings form user input, wide open to injection attack, use parameterised queries.
That said your SQL will do what you ask, however it is a SELECT statement which will return rows of data to your program, take it that part of your sqlQuery string is missing as you also need a FROM and table name.
You execute it as NonQuery which will return nothing from a SELECT anyway, you need to look at UPDATE if you want to alter the values in table(s).
|
|
|
|
|
Hy. I have VB page. Now I added Page_Load with some actions in it and I got error
Error BC30652 Reference required to assembly 'App_Code.ukzuepxw, Version=1.0.6298.24385, Culture=neutral, PublicKeyToken=null' containing the type '[Global]'. Add one to your project.
I fixed it, by commenting the function and reloading the environment. And when I started to run my app, it worked without function off course, because it is commented. So now it looks like there is a problem with function though no syntax error detected. So what I did is I uncommented that function during runtime and reloaded the page. And it works. Could you explain me what`s going on here.
modified 30-Mar-17 7:56am.
|
|
|
|
|
Means VS cannot find the assembly that is to contain that function. Since it is now in comments, the compiler ignores it.
Add a reference to the assembly. Google knows how
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Hy, I get error Object reference not set to an instance of an object.
code:
For index = 1 To Data.Count
table_Rows = table_Rows + <![CDATA[
<tr>
<td style = "padding-bottom: 2px; width: 161px; padding-top: 2px; border-bottom: gray 1px solid;
height: 25px" >
]]>.Value
table_Rows = table_Rows + Data.Item(index).InnerText
table_Rows = table_Rows + <![CDATA[</td>
<td align = "right" style="padding-right: 5px; padding-left: 2px; padding-bottom: 2px;
width: 160px; padding-top: 2px; border-bottom: gray 1px solid; height: 25px">
]]>.Value
table_Rows = biblioteka.Item(index).InnerText
table_Rows = <![CDATA[</td>
<td style = "padding-bottom: 2px; padding-top: 2px; border-bottom: gray 1px solid;
height: 25px" >
</td>
</tr>
]]>.Value
Next
the error points to rows:
table_Rows = Data.Item(index).InnerText
and
table_Rows = lib.Item(index).InnerText
modified 30-Mar-17 6:24am.
|
|
|
|
|
The Message means that there is no Object to be found at the 'index'-Position.
Perhaps you should look how your Array is build up - normally it starts with index=0.
So your Loop should be :
For index = 0 To Data.Count -1
|
|
|
|
|
you are right. Thanks for pointing me on the way. I can`t imagine how did I miss this solution.
|
|
|
|
|
how to make a program multithread to find a max number in array??
sample code please..
|
|
|
|
|
How about showing us what you've tried so far?
=========================================================
I'm an optoholic - my glass is always half full of vodka.
=========================================================
|
|
|
|
|

#include <stdio.h>
#include <windows.h>
DWORD Sum;
DWORD WINAPI Summation (LPVOID param);
typedef struct{
int start;
int end;
} SUM_INFO;
const int numOfThreads = 5;
SUM_INFO *sumInfo[numOfThreads];
DWORD sumThreads[numOfThreads];
int main(int argc,char *argv[])
{
DWORD ThreadsId;
HANDLE *ThreadHandle;
int Param ,i = 0,j = 0;
DWORD totalSum = 0;
if (argc != 2 ){
fprintf( stderr,"An integer parameter is required\n");
return -1;
}
Param = atoi (argv [1]);
printf ("param = %d \n",Param);
if (Param < 0){
fprintf (stderr," an integer >= 0 is required \n" );
return -1 ;
}
ThreadHandle = (HANDLE *)malloc (5 * sizeof(HANDLE));
for (j = 0; j < numOfThreads ; j++){
sumInfo[j] = (SUM_INFO *) malloc (sizeof (SUM_INFO));
sumInfo[j] -> start = ( j * (Param/numOfThreads)) + 1 ;
sumInfo[j] -> end = (j+1)*(Param/numOfThreads);
WaitForSingleObject(ThreadHandle[j-1],INFINITE);
ThreadHandle[j] = CreateThread (NULL,0,Summation,sumInfo[j],0,&ThreadsId);
if (ThreadHandle == NULL)
GetLastError();
}
WaitForMultipleObjects(numOfThreads,ThreadHandle,TRUE,INFINITE);
CloseHandle(ThreadHandle);
for (i=0;i< numOfThreads;i++)
totalSum +=sumThreads[i];
printf("total sum = %u\n",totalSum);
}
DWORD WINAPI Summation (LPVOID Param)
{
static int threadCount = 0;
printf("Thread %d\n is started\n",threadCount);
SUM_INFO *temp = (SUM_INFO * )Param;
DWORD start = (DWORD ) temp -> start;
DWORD end = (DWORD ) temp -> end;
printf("start = %u \n ",start);
printf("end = %u \n",end);
DWORD i,sum= 0;
for (i = start ; i<= end;i++)
sum+= (DWORD)i;
sumThreads[threadCount] = sum;
printf("sum Threads [%d]= %u\n",threadCount,sumThreads[threadCount]);
threadCount++;
return 0;
}
like this,actually the code is to count number 1-5000000 with multi threads,but i don't know,how to changes this code to find the max number.
|
|
|
|
|
Somehow I don't think that that code is Visual Basic - try posting in the C++ forum
=========================================================
I'm an optoholic - my glass is always half full of vodka.
=========================================================
|
|
|
|
|
|
hello guys I'm having a problem with a project that I build
I'm trying to import excel files to sql server 2016 using bulkcopy and I got this error
The Microsoft Office Access database engine could not find the object 'C:\Users\WilliamNick\Desktop\DAFTAR1.xlsx'. Make sure the object exists and that you spell its name and the path name correctly."
I think there is a problem with this code
Dim query_excel As String = "SELECT * from [" & file & "$]"
i tried all of this code on another pc and it works perfectly but on my pc it's getting that error, I don't know what did I wrong, I'm using visual basic 2010 professional edition, sql management server 2016 and microsoft office 2016
can anyone help me to figure what is wrong with the code ?
<pre>Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If OpenFileDialog1.ShowDialog = DialogResult.OK Then
TextBox1.Text = OpenFileDialog1.FileName
file = System.IO.Path.GetFileNameWithoutExtension(TextBox1.Text)
End If
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim koneksi_excel As New System.Data.OleDb.OleDbConnection("Provider=Microsoft.ace.OLEDB.12.0;Data Source='" & TextBox1.Text & "';Extended Properties=""Excel 12.0 Xml;HDR=YES;""")
koneksi_excel.Open()
Dim query_excel As String = "SELECT * from [" & file & "$]"
Dim cmd As OleDb.OleDbCommand = New OleDb.OleDbCommand(query_excel, koneksi_excel)
Dim rd As OleDb.OleDbDataReader
rd = cmd.ExecuteReader()
Dim koneksi As New SqlClient.SqlConnection()
Dim koneksidatabase As String = "server=DESKTOP-KJQ8PNO\SQLEXPRESS;database=otto;Integrated Security=True"
koneksi.ConnectionString = koneksidatabase
koneksi.Open()
Dim da As New OleDb.OleDbDataAdapter
Dim ds As New DataSet()
Dim dt As New DataTable
ds.Tables.Add(dt)
da = New OleDb.OleDbDataAdapter(query_excel, koneksi_excel)
da.Fill(dt)
Using bulkcopy As SqlClient.SqlBulkCopy = New SqlClient.SqlBulkCopy(koneksi)
bulkcopy.DestinationTableName = file
bulkcopy.BulkCopyTimeout = 600
bulkcopy.WriteToServer(rd)
rd.Close()
MsgBox("Data uploaded to database", MsgBoxStyle.Information, "Uploaded")
TextBox1.Text = ""
End Using
End Sub
|
|
|
|
|
Try renaming the file and remove any special characters in the file or path.
|
|
|
|
|
I need a macro that will hide and unhide rows and columns that contain all zero values. I strated with the following code that hide and unhide columns with zero but it does not work. Does anyone know how to fix it.
Sub HideEmptyColumns()
' This macro hides empty or all-zero columns in the active worksheet
' It ignores columns outside the used range (UsedRange)
Dim Col As Range
For Each Col In ActiveSheet.UsedRange.Columns
Col.EntireColumn.Hidden = AllZero(Col)
Next Col
End Sub
Sub UnhideColumns()
' This macro unhides all columns on the active worksheet
Columns.Hidden = False
End Sub
Function AllZero(R As Range) As Boolean
' This function returns TRUE if the range is entirely empty or all zero
Dim C As Range
AllZero = True
For Each C In R.Cells
If C.Value <> 0 Then
AllZero = False
Exit For
End If
Next C
End Function
|
|
|
|