|
Quote: Have you contacted the manufacturer of said scanner and asked them how to interact with it programmatically? Probably through an API that they would have to provide.
If you are new to programming then getting a scanner to work through an API is probably beyond your current capabilities.
Your table (it is not a database) should also include a unique identifier for the person (after all, people can have the same name).
Do not store the actual document on the database, store it's relative path or it's path relative to a fixed folder name.
|
|
|
|
|
HI
I NEED HELP IN TRYING TO WRITE DATABSE PROGRAM TO IN ACCESS OR PYTHON CAPTURE THE NAME, ID NUMBER, ADDRESS, PHONE NUMBER, AND FIELD TO ABLE TO SCAN DOCUMENT TO FROM A FLAT BED SCANNER TO MY ACCESS DATABSE FIELD.
WHEN I PRESS A BUTTON ON THE FORM. I AM STILL LEARNING PYTHON AND ACCESS
PLEASE HELP
|
|
|
|
|
|
Scenario:
one User1 press the save gets the last number 1000012 on the header then Run SP for Details saving(with 3 detail line items)
at the same time user2 press the save gets 1000013 on the header then Run SP for Details saving
(with 1 detail line items)
after checking after checking users inserted
user1 has 4 lines
user2 has 0 lines
ALTER PROCEDURE [dbo].[sp_HeaderSave] (@Lastnumber Decimal) AS
BEGIN
INSERT INTO Header (DOCNo, VersionNo, NoteDate)
VALUES (@Lastnumber,'VersionNo',GETDATE())
END
ALTER PROCEDURE [dbo].[sp_DetailSave] (@Lastnumber Decimal) AS
BEGIN
INSERT INTO Detail(DOCNo, ItemNo, Qty)
VALUES (@Lastnumber,'Items One',12)
END
thank you,
|
|
|
|
|
|
i tired this, how can i pass the @lastnumber it came from other table?
CREATE TABLE ControlNumbers (
LastNumber Varchar(50)
)
|
|
|
|
|
Hotaxion wrote: CREATE TABLE ControlNumbers (
LastNumber Varchar(50)
)
Interesting! In your OP you declared LastNumber as "Decimal". Now you show some other LastNumber which is in this case Varchar(50).
Are these two different? Or which type is correct?
And why not use the int with Identity? Something like:
CREATE TABLE ControlNumbers (
LastNumber Int IDENTITY(1,1)
)
|
|
|
|
|
the front end of the application is returning last number and saving it like this "M01-00002" on the Table i get the Right(lastnumber,5) then Plus 1 ty
|
|
|
|
|
As I said, either use an IDENTITY column, or use a SEQUENCE .
A varchar column can't automatically generate new values.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
the scenario is i can't modified/change the Table datatype coz other application is using it.. lets say the table is on our ERP.
|
|
|
|
|
Another technique is to have another table that just generates the ids for you
CREATE TABLE IdsList(id INT IDENTITY(1,1), datum CHAR(1));
In your (single) stored procedure first do this
INSERT #IdsList(datum) VALUES('x');
declare @lastnum int = (SELECT SCOPE_IDENTITY()) I would also suggest putting your stuff into a single SP and wrapping it all up in a transaction
ALTER PROCEDURE [dbo].[sp_HeaderSave] (@Lastnumber int OUTPUT) AS
BEGIN
BEGIN TRANSACTION [MyTrans]
BEGIN TRY
INSERT #IdsList(datum) VALUES('x');
SET @lastnumber int = (SELECT SCOPE_IDENTITY())
INSERT INTO Header (DOCNo, VersionNo, NoteDate)
VALUES (@Lastnumber,'VersionNo',GETDATE())
COMMIT TRANSACTION [MyTran]
END TRY
BEGIN CATCH
ROLLBACK TRANSACTION [MyTran]
END CATCH
END
|
|
|
|
|
AKA the poor man's SEQUENCE[^].
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I have a friend who cosponsors a conference every 2 years and manages the sending out of meeting notices and other items to the 2000 or so possible attendees via email. Can anyone recommend a Mail Merge type program, free or not?
Charles Wolfe
C. Wolfe Software Engineering
|
|
|
|
|
|
He has been using Google's mail merge, but it has limitations e.g. can't send more than about 900 emails in a batch and he's got to get out 2000 plus several times a year. He needs something easier to manage than Google's and allows more messages to be sent out at a time.
Charles Wolfe
C. Wolfe Software Engineering
|
|
|
|
|
You should have followed the link ... it was a google search for mail merge programs, not a link to googles mail merge program!
|
|
|
|
|
So I can add and delete Mongo documents but I ran into trouble with updates using HTTPPut.
When I get the record from the controller, the ObjectId in Angular is sort of truncated down to the string. When I pass it back to the controller, the controller complains that it's not a valid MongoDB ObjectID and HTTP 400 me. The response was not a valid ObjectID.
I tried changing my angular model Id to object
public Id: string --- Before
public Id: object --- After
Took the BSON decorators out of the .Net Model, which is the MongoDB model
[BsonId]
[BsonRepresentation(BsonType.ObjectId)]
public ObjectId Id { get; set; }
Not really sure what direction to go here to keep my mean stack.
HtTP Response
HTTP/1.1 400 Bad Request
Transfer-Encoding: chunked
Content-Type: application/json; charset=utf-8
Vary: Origin
Server: Kestrel
Access-Control-Allow-Credentials: true
Access-Control-Allow-Origin: <a href="https://localhost:44367">https:
X-Frame-Options: DENY
X-SourceFiles: =?UTF-8?B?RzpcamtpcmtlcnhBbmd1bGFyXGFwaVxwb3J0Zm9saW9zXFVwZGF0ZVBvcnRmb2xpb1w1YmFkNTEyMGM0MzFjYjA1NjQxNTE2NTk=?=
X-Powered-By: ASP.NET
Date: Thu, 27 Sep 2018 23:09:47 GMT
7f
{"Id":["Error converting value \"5bad5120c431cb0564151659\" to type 'MongoDB.Bson.ObjectId'. Path 'Id', line 1, position 32."]}
0
If it ain't broke don't fix it
Discover my world at jkirkerx.com
modified 27-Sep-18 19:11pm.
|
|
|
|
|
It looks like a fairly standard serialization error. I don't think you need the BsonRepresentationAttribute here.
Have you had a look at the docs:
Mapping Classes
The default for Id mapping is the string type, but you can use ObjectId as you are, but you need to set a specific IdGenerator.
Going through the references for the various IdGenerators in the MongoDB.Bson.Serialization.IdGenerators namespace, it looks like there are 3 candidate generators for ObjectId. I don't know which one is more appropriate for your use case, but if I were to venture a guess the general ObjectIdGenerator should be appropriate:
MongoDB.Bson.Serialization.IdGenerators Namespace
So, your mapping ultimately should look like:
[BsonId(IdGenerator = typeof(ObjectIdGenerator)]
public ObjectId Id { get; set; }
"Never attribute to malice that which can be explained by stupidity."
- Hanlon's Razor
|
|
|
|
|
I thought about it last night and decided to just remove that column and not use the BSON Object ID, but to use the string version of the Object ID instead. This might get me later on when I find out that I need that Object for something, not sure what yet, To lookup the server that wrote the record or the other data stored in the ObjectId.
After testing just now, I can finally reach the .Net Controller for Update without my posted error.
Well basically my mean stack now works for updates using HTTPPUT. First time so I'm excited because it completed my stack operations.
But I'll go ahead and investigate and try that type and see what happens.
I thought maybe I needed to decorate the controller action with something that would regenerate the ObjectId back to the proper format.
Thanks for helping me!
If it ain't broke don't fix it
Discover my world at jkirkerx.com
|
|
|
|
|
Do I really need to store that Object ID in it's natural format?
Or is it possible to just store the string, and then convert it back to it's natural format using something on the .Net Core side if I need it? Maybe on the Angular side there is something to convert it with as well?
My mean stack fully works now, guess I'll try your research and see what happens. If it works I'll store the Object.
This is how my Mongo record looks now.
{
"_id" : "5bae68208301500628d80f8c",
"TimeStamp" : ISODate("2018-09-28T17:42:57.068Z"),
"Name" : "Long Beach Grand Prix 2008",
"Description" : "I took this photo at the Long Beach Grand Prix",
"CreatedBy" : "admin",
"HTML" : "",
"AvatarB64" : "data:image/jpeg;base64, data string.
"AvatarName" : "5bae68208301500628d80f8c.jpg",
"AvatarType" : "image/jpeg",
"AvatarUrl" : "<a href="https://localhost:44367/content/images/avatars/portfolios/5bae68208301500628d80f8c.jpg">https:
"AvatarX" : 256,
"AvatarY" : 256,
"AvatarStatus" : true
}
If it ain't broke don't fix it
Discover my world at jkirkerx.com
|
|
|
|
|
I've always just modeled it as a string when I've needed to. I assumed you were going for the C# Mongo ObjectId for your own reasons :p
Keep in mind, this isn't about how you're storing it, but rather just how you're referencing it after deserialization.
"Never attribute to malice that which can be explained by stupidity."
- Hanlon's Razor
|
|
|
|
|
nah, just no clue and part of the learning process.
If it ain't broke don't fix it
Discover my world at jkirkerx.com
|
|
|
|
|
jkirkerx wrote: ObjectId....HTTP...application/json
You have an object.
You are attempting to serialize it to json for use in an http request. I suspect you might want deserialize at some point as well.
So you need a json serializer/deserializer. Just as you would for any object.
It probably already is doing that but what you are getting is the complex form (the Mongodb form fully blown out) and what you actually want is the stringified version of that id. So you need a custom serializer/deserializer.
You should already have an http layer is some form so you just need to add that in there.
|
|
|
|
|
I saw some examples of serializing and deserializing the ObjectId. But wanted to see some progress or get my mean stack working first.
In the database I stored the #C .Net ObjectId, but say on a Http Get request Angular got it as a simple string. Send it from Angular back to the controller with a Put or Post sent the string, but the controller was looking for the ObjectId.
I get it now, since I took the ObjectId out of the model and can Get, Post, Put, Delete now.
I'll take your thoughts and research more on it, do some test.
Overall:
This Portfolio module I just wrote in Angular 6 TypeScript is pretty slick. Drag and Drop, Select image button and extract it as a base64 string and update the thumbnail preview. You can change the image as many times as you want, I don't care. Then submit and fire off the model to the controller, controller processes the image, even flips it around if it's from an iPhone, write it's to disk, creates a MongoDB document, then updates the model and sends it back to Angular and updates the page. I just need a pretty progress icon now.
I wrote very few lines of code, mostly worked on keeping really small and compact and tons of research and experimenting.
730 lines. I should measure the image data and store it in the database to detect image updates, and then fire off the graphics mode.
If it ain't broke don't fix it
Discover my world at jkirkerx.com
|
|
|
|
|
Run this application correctly from vb.net code
when build this application and compile Exe file
Run Exe file error display:
Cannot open database "COLORS". User login failed for user "Administrator"
|
|
|
|