|
Upload to where? FTP, a webserver, a database?
What did you try? Have you tried copy/pasting one of the examples on the internet?
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
string queryString = "select * from bbb where A1=:A1 and B1=:B1";
public OracleParameter[] GetSqlParameters(string[] fields, object[] obj)
{
try
{
OracleParameter[] parameters = new OracleParameter[obj.Count()];
for (int i = 0; i < obj.Count(); i++)
{
parameters[i] = new OracleParameter(fields[i], obj[i]);
}
return parameters;
}
catch
{
return new OracleParameter[] { };
}
}
how to use this method?give a example!
thinks!
|
|
|
|
|
Ask the person who wrote it?
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Hi,
The way I understand this is that this function is used to add parameters and their type before making a call to the database.
You may write like that:
string[] fields = new string[3];
fields[0] = "param1";
fields[1] = "param2";
fields[2] = "param3";
object[] obj = new object[3];
obj[0] = OracleDbType.Varchar2;
obj[1] = OracleDbType.Decimal;
obj[2] = OracleDbType.Decimal;
OracleParameter[] GetSqlParameters(fields, obj);
You can optimize the above code to a great extent.
|
|
|
|
|
thanks first,
but
how to input the values :A1?
example select * from bbb where A1=:A1 and B1=:B1
:A1 = 'abc', :B1='123'
modified 16-Oct-14 22:56pm.
|
|
|
|
|
So I've run into a snag that is driving me insane. I've built two async connectors: one is to a SQL Server database and have exposed it through WebApi (for a .NET sanity check) and through a Task<object> interface exposed for node consumers. The second uses a TaskCompletionSource that wraps an arbitrary list with a Task (for a node sanity check).
When I Debug the Web Api project and nav to my route that is attached to the database, everything does fine. The data from my database is returned to the browser.
When I node my server attached to the mocked async route, everything does fine. My mock is returned to my server and I spool the object to the console.
HOWEVER...when I try to wire node in to consume the attached data connector, when I browse to the open node port, my server crashes with an error "Process is terminated due to StackOverflowException."
The frustration comes from the fact that I'm doing nothing fancy and the connector retrieves data just fine from an api route.
My server:
var edge = require('edge');
var http = require('http');
var port = process.env.PORT || 8088;
var userRepository = {
getUsers: edge.func({
assemblyFile:'Edge.Test.dll',
typeName: 'Edge.Test.DataConnector',
methodName: 'Invoke'
})
};
function logError(error, response){
console.log('[Error]:{' + error+'}');
response.writeHead(200, { 'Content-Type': 'text/plain'});
response.write('[Error]:' + error);
response.end("");
}
http.createServer(function(request,response){
console.log('Creating Server...');
response.writeHead(200, {'Content-Type':'text/html'});
var payload = {};
console.log('[Before][userRepository.getUsers]');
userRepository.getUsers(payload, function(error, result){
console.log('[Result][userRepository.getUsers]');
if(error){logError(error, result);return;}
if(result){
response.write("<ul>");
result.forEach(function(user){
console.log("[Response contains User]{"+user.FirstName+"|"+user.LastName+"}");
response.write("<li>" + user.FirstName + " " + user.LastName);
});
response.end("</ul>");
}
else{
response.end("No users found");
}
});
}).listen(port);
console.log("Node server listening on port: " + port);
The async connection point
public async Task<object> Invoke(object input)
{
var payload = (IDictionary<string, object>)input;
return await GetUsers();
}
public async Task<List<Data.User>> GetUsers()
{
TaskCompletionSource<List<Data.User>> source = new TaskCompletionSource<List<Data.User>>();
Task<List<Data.User>> task = source.Task;
var connector = new Data.SqlServer();
Task.Factory.StartNew(() =>
{
source.SetResult(connector.GetUsersSync());
});
return await task;
}
The ADO.NET calls
public async Task<List<User>> GetUsers()
{
List<User> users = new List<User>();
using (var connection = new SqlConnection(ConnectionString))
{
using (Command = connection.CreateCommand())
{
await connection.OpenAsync();
Command.CommandType = System.Data.CommandType.Text;
Command.CommandText = "SELECT UserId, FirstName, LastName FROM [dbo].[User]";
using (Reader = await Command.ExecuteReaderAsync())
{
while (await Reader.ReadAsync())
{
User user = new User();
user.Id = Reader[0] as int? ?? default(int?);
user.FirstName = Reader[1] as string;
user.LastName = Reader[2] as string;
users.Add(user);
}
}
}
}
return users;
}
Again, the TaskCompletionSource returns to node when I put a hard coded List in it. SQL Server returns to the WebApi Controller, but SQL Server will not return to node; I get a Stack Overflow.
"I need build Skynet. Plz send code"
modified 15-Oct-14 23:35pm.
|
|
|
|
|
...any ideas?
I was able to get the data from SQL Server marshaled back to node by using Express, but it would only execute successfully on server start up (I called the repository method directly on server start and then spooled the results to the console)
But if I try to activate the '/users' route, I get the StackOverflow exception...but it is only occurring if the CLRMethod I'm using is attached to the database. If I manually build the Task to return and stuff a list of hard coded objects in it, I have a happy path.
"I need build Skynet. Plz send code"
|
|
|
|
|
Solved. I thought there was something funny about my express route...there was no serialization of the response.
app.get('/users', function(request, response){
users.repository.getUsers({}, function(error, result){
response.json(result);
});
});
Works beautifully now.
"I need build Skynet. Plz send code"
|
|
|
|
|
For completeness' sake, I thought I'd provide some additional clarification.
Notice in the original code that I posted that in the GetUsers() method that calls the data connector, I did not await the Resolution of the promise. In fact, I didn't need to resolve that manually, so I changed the code that read like this...
var connector = new Data.SqlServer();
Task.Factory.StartNew(() =>
{
source.SetResult(connector.GetUsersSync());
});
return await task;
to instead read like:
DataConnector connector = new DataConnector();
return connector.GetUsers();
and then, to keep the async task from "completing before another async task could complete", I had to await the call to the data connector
DataConnector connector = new DataConnector();
return await connector.GetUsers();
It was really easy once I was able to spot it. I just skipped over the StartNew(() call every time I was analyzing; took way too many looks to notice that it was not executing asynchronously.
"I need build Skynet. Plz send code"
|
|
|
|
|
i am trying to deploy my program using Inno Setup 5.4.0(u).
and it don't works with dll of .net when i register Windows XP computers, it's waning error: unable to register the dll/ocx regsvr32 failed with exit code 0x4
[Files]
Source: Library\DevExpress.Data.v8.3.dll; DestDir: {sys}; Flags: ignoreversion regserver uninsneveruninstall
...
in the following files
C:\Windows\system32\DevExpress.Data.v8.3.dll
...
Inno Setup can't really use anything but regsvr32 to install a DLL or OCX, any Windows Installer. Inno Setup 5.4.0(u) not support install file dll of net ?
can you help me ?
|
|
|
|
|
Why aren't you asking this on the InnoSetup forums? This has absolutely nothing to do with C#.
|
|
|
|
|
Ask in the InnoSetup forums.
.NET .DLL's cannot be registered using REGSVR32. That only works with native COM-based .DLL's.
.NET DLL's have to be registered using REGASM, found under Start -> Microsoft Visual Studio xxxx -> Visual Studio Tools -> xxx Command Prompt.
|
|
|
|
|
I know Standard .NET DLLs do not need registration at all. Just install them into {app} along with your .exe file but i want to know the registration library .NET DLLs to windows because some applications do this. follow me know regasm just use COM DLLs, not install .Net DLLs. I have tried installing with regasm but not yet, has anyone installed with regasm ? Why do you have to put the concept Inno Setup Inno Setup asked in the forum because I installed from cmd or Run dressed, I will switch to the respective language with Inno Setup is. Here is the syntax of regasm in win:
@ECHO OFF
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\RegAsm.exe *path to .dll file* /codebase
regedit.exe /s *path to .reg file*
cls
|
|
|
|
|
If you have COM-exposed .NET .DLL's being consumed by unmanaged code, then you have to register them.
|
|
|
|
|
DevExpress dll's don't have to be "registered"; and DON'T install then in a Windows "system" folder (e.g. Windows\System32).
Install them in the same application folder as your program's EXE; e.g. Program Files\... (in the case of XP).
|
|
|
|
|
|
I want to draw between cells in excel data request.How can I do?
|
|
|
|
|
You'll need to expand on that question if you want a decent answer.
Which cells? In an Excel worksheet, on a grid of your own, where? What data request? Is Excel doing the requesting? How?
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
I have my cell 30 bottom in excel.I need to pull this data using the loop.How can I do
|
|
|
|
|
Doesn't improve much on clearness.
If you want to loop data in an Excel-spreadsheet, there's multiple ways to do so. One is rather easy, using a IDbConnection - but that would be specifically aiming at the values, no painting.
Depending on WHERE you want to paint, it should be done from Excel or your own application. I'd recommend you first google for some examples on reading an excel-file and see how far you get.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Could you please help me.I'm trying for a long time because.I would be glad if you can help.
|
|
|
|
|
Kalay16 wrote: Could you please help me I'm a trying to, but I do not know "how".
Kalay16 wrote: I'm trying for a long time because Explain, using lots of small words what you are trying. Any code you can share would help too.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
var cell = (Microsoft.Office.Interop.Excel.Range)excelWorksheet.Cells[5, 3];
label1.Text = Convert.ToString(cell.Value);
cell = (Microsoft.Office.Interop.Excel.Range)excelWorksheet.Cells[6, 3];
label2.Text = Convert.ToString(cell.Value);
cell = (Microsoft.Office.Interop.Excel.Range)excelWorksheet.Cells[7, 3];
label3.Text = Convert.ToString(cell.Value);
cell = (Microsoft.Office.Interop.Excel.Range)excelWorksheet.Cells[8, 3];
label4.Text = Convert.ToString(cell.Value);
cell = (Microsoft.Office.Interop.Excel.Range)excelWorksheet.Cells[9, 3];
label5.Text = Convert.ToString(cell.Value);
I want to do with the loop .
|
|
|
|
|
Kalay16 wrote: I want to do with the loop What has that to do with drawing?
for (int i = 0; i < 9; i++)
{
cell = (Microsoft.Office.Interop.Excel.Range)excelWorksheet.Cells[i, 3];
} When posting a question on Excel, do state that you're using "Office Interop"; there's more than one way to do stuff with excel, and it helps to know which one.
If you still need to draw (in Excel), then you might want to investigate the "Border" property and the likes, on MSDN[^].
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
for (int i = 0; i < 10; i++)
{
var cell = (Microsoft.Office.Interop.Excel.Range)excelWorksheet.Cells[i, 3];
listView1.Items.Add(Convert.ToString(cell.Value));
}
0x800A03EC
Check the ErrorCode property of the exception to determine the HRESULT returned by the COM object.
Gave such an error .In line count of 103.My range of cells B5:B35.
There are compatibility issues .Therefore, I am having a lot of errors.
|
|
|
|