|
|
Thank you, but I already use that kind of sample with C#.
Unfortunately, I think that the problem is in VB.NET...
I'm need that code to work on VB.NET, because when I use C# it realy works good!
Can you explain me why?
Miguel
|
|
|
|
|
Here is a section of an object I use to solve the issue. _bm is a Bitmap and _ms is a MemoryStream. You should be able handle it from here.
public void Load(object dbField)
{
Clear();
if (dbField != DBNull.Value)
{
byte[] buf = (byte[])dbField;
_ms = new MemoryStream(buf);
_bm = (Bitmap) Image.FromStream(_ms);
}
}
public object Save()
{
if (_bm == null)
{
return DBNull.Value;
}
else
{
MemoryStream ms = new MemoryStream();
_bm.Save(ms,_bm.RawFormat);
byte[] buf = ms.GetBuffer();
ms.Close();
return buf;
}
}
|
|
|
|
|
Thank you, but I already use that kind of sample with C#.
Unfortunately, I think that the problem is in VB.NET...
I'm need that code to work on VB.NET, because when I use C# it realy works good!
Can you explain me why?
Miguel
|
|
|
|
|
|
can anyone correct for me this:
CString strText;
CString strSQL;
CDaoDatabase db;
db.Open("D:\\copyktt.mdb");
m_cedit.GetWindowText(strText);
strSQL.Format("INSERT INTO Table6 SELECT * FROM Table3 IN 'C:\\ktt.mdb' WHERE MyField = %s",strText);
db.Execute(strSQL);
|
|
|
|
|
Missing single quotes around %s...
Very bad practice here, vulnerable to sql injection attack. Just type x;delete * from Table6 into m_cedit and you're toast.
|
|
|
|
|
<br />
CREATE TABLE TestTable<br />
(Field1 INT)<br />
GO<br />
<br />
DECLARE @Err INT<br />
<br />
INSERT INTO TestTable (field1) VALUES (9999999999)<br />
SELECT @Err = @@Error<br />
IF @Err <> 0<br />
BEGIN<br />
PRINT 'Im In'<br />
INSERT INTO TestTable (field1) VALUES ('1235456')<br />
END<br />
<br />
SELECT * FROM TestTable WHERE field1 = 'ABC'<br />
SELECT @Err = @@Error<br />
IF @Err <> 0<br />
BEGIN<br />
PRINT 'Im In'<br />
INSERT INTO TestTable (field1) VALUES ('1235456')<br />
END<br />
When executing the above code, you will enter the first @Err condition but not the second. Both errors produce the same Severity level so I'm not sure why it resumes on one but not the other. Is there any way to force an SP to resume next?
-Kay
|
|
|
|
|
kayos592 wrote: When executing the above code, you will enter the first @Err condition but not the second.
I don't see where the second condition, a simple SELECT, could fail under normal conditions. It could return an empty result set, but that's about it.
What error are you expecting?
kayos592 wrote: Both errors produce the same Severity level so I'm not sure why it resumes on one but not the other.
I don't see what error the second condition is producing. And I don't know what you mean by "it resumes on one but not the other".
|
|
|
|
|
If you execute the attached code in SQL Query analyzer you will see what I'm talking about. Basically, if you try a simple select on an INT field where the where condition is looking for Alpha characters it will give you an error.
Simply put, the below code is a simple select which causes an error. Now I know I can check values prior to everything but I want it to continue onto the next record in the event that a simple select causes an error instead of just dying. Please let me know if I should elaborate...
<br />
CREATE TABLE TestTable<br />
(Field1 INT)<br />
GO<br />
<br />
DECLARE @Err INT<br />
<br />
SELECT * FROM TestTable WHERE field1 = 'ABC'<br />
SELECT @Err = @@Error<br />
IF @Err <> 0<br />
BEGIN<br />
PRINT 'Im In Error Handling number 2'<br />
END<br />
Now what I mean by "it resumes on one but not the other" is for the first error it will go into the error condition and even execute more of the script, however on the simple select error, it will stop right there and progress no further. Hope that clarifies...
-Kay
|
|
|
|
|
Hi all,
I need some help regarding SQL query.
I have the following requirement:
I have 3 tables(in bold) with columns as following:
Unit
UnitId
ListUnit
UnitId,ListId
List
ListId
And I have the records as following in the above mentioned tables:
Unit
1
2
3
ListUnit
1,1
1,3
2,1
2,2
3,2
3,1
List
1
2
3
Now I want to retrieve only top 1st (UnitId,ListId) from the group
I.e. 1,2 from (1,2
1,1
1,3) group.
Then
2,1 from (2,1
2,2) group.
And
3,2 from (3,2
3,1) group.
So how could I write SQL Query for this?
Thanks,
Rachit Damani.
|
|
|
|
|
You are saying groups, what exactly will be in a group?
When you say 1,1 from 1,1;1,2;1,3 what are these values?
are these a comination of unit and list tables or values from unitlist table?
Gautham
|
|
|
|
|
I needed to grant my windows login on SQL Server 2005 UNSAFE ASSEMBLY permission, which I was able to do with a simple grant statement, but under what authority am I granting that permission to myself? Is it the server owner or admin, being a member of administrators on the host, my machine?
|
|
|
|
|
My guess would be sysadmin on the grounds that the assembly could affect the entire server process, not just the database that uses it.
Checking the documentation it says for CREATE ASSEMBLY[^]: Only members of the sysadmin fixed server role can create and alter UNSAFE assemblies.
|
|
|
|
|
I'm starting to see the link to my machine login now. My Windows login on SQL is only a member of dbcreator, but the BUILTIN\Administrators group has the sysadmin role.
|
|
|
|
|
i started studying myself C++ and VC++ 4 months ago.i have done some simple applications.And my new task is show a table (in mdb)file in a list control in my application. And can copy selected row in the list control in another table in another location.Drafly like that.I have tried for 32or 3 weeks aready, but haven't finished yet and found a lot of problem.Am i too stupid?hehe
|
|
|
|
|
No! Keep trying, thats the way all learn!
Gautham
|
|
|
|
|
thank you so much,
|
|
|
|
|
how to store and retrive an video file in database
ramakrishana
|
|
|
|
|
Create a BLOB in the database and store it in there.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
how to delete duplicate rows in a table if that tables has no primary key
|
|
|
|
|
The quickest method is to add a primary key to that table. You can always remove it after you've deduped the table.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
hi,
i m newbie for Sql server.presently i m developing application in vb.net
can anybody tell me what is the exact connection string to connect sql server which is located remotely .
Related information is following:
Server Side:
SQL server 2000
IP address- xx.xx.xx.xx
Database Name-MyDatabase
UserName-Myuser
Password-MyPassword
Client Side
XP SP2
VB.NET
SQL Express Edition 2005
SQL Native Client
Thanks
Rupesh Kumar Swami
Software Engineer,
Integrated Solution,
Bikaner (India)
|
|
|
|
|
I dont know this if will help you but try this this is the Common one
"Data Source=ipaddress;Initial Catalog=db;User Id=username;Password=apassword;"
Is the server on the same Lan as you are?
tell me if it helped
Vuyiswa
|
|
|
|
|
actually server is located remotely (mean on the internet).
i already use connectionstring provided by you.
Rupesh Kumar Swami
Software Engineer,
Integrated Solution,
Bikaner (India)
|
|
|
|